Go forward to Exception Handling.
Go backward to Set Breaks.
Go up to Breakpoints.
Setting watchpoints
-------------------
You can use a watchpoint to stop execution whenever the value of an
expression changes, without having to predict a particular place where
this may happen.
Watchpoints currently execute two orders of magnitude more slowly
than other breakpoints, but this can be well worth it to catch errors
where you have no clue what part of your program is the culprit.
`watch EXPR'
Set a watchpoint for an expression. GDB will break when EXPR is
written into by the program and its value changes. This can be
used with the new trap-generation provided by SPARClite DSU. DSU
will generate traps when a program accesses some date or
instruction address that is assigned to the debug registers. For
the data addresses, DSU facilitates the `watch' command. However
the hardware breakpoint registers can only take two data
watchpoints, and both watchpoints must be the same kind. For
example, you can set two watchpoints with `watch' commands, two
with `rwatch' commands, *or* two with `awatch' commands, but you
cannot set one watchpoint with one command and the other with a
different command. {No Value For "GBDN"} will reject the command
if you try to mix watchpoints. Delete or disable unused
watchpoint commands before setting new ones.
`rwatch EXPR'
Set a watchpoint that will break when watch ARGS is read by the
program. If you use both watchpoints, both must be set with the
`rwatch' command.
`awatch EXPR'
Set a watchpoint that will break when ARGS is read and written into
by the program. If you use both watchpoints, both must be set
with the `awatch' command.
`info watchpoints'
This command prints a list of watchpoints and breakpoints; it is
the same as `info break'.
*Warning:* in multi-thread programs, watchpoints have only limited
usefulness. With the current watchpoint implementation, GDB can
only watch the value of an expression *in a single thread*. If
you are confident that the expression can only change due to the
current thread's activity (and if you are also confident that no
other thread can become current), then you can use watchpoints as
usual. However, GDB may not notice when a non-current thread's
activity changes the expression.