User`s guide

62
Chapter 6: Controlling Program Execution
stop [expression|variable] in procedure
Inspects the value at every source line within a given
procedure. Stops if the value has changed.
If the expression is of type pointer, look at the data pointed
to and watch until it changes.
If the expression is not of type pointer, look at the 32 bits at
that address (assume the expression evaluates to an
address).
Using Fast Watchpoints
You can use fast watchpoints with the stop command. A fast watchpoint
watches a specified variable or memory address without severely impacting
the performance of the program being debugged.
In previous versions of dbx, the debugger had to single-step the process
being debugged and check if the value of a variable had changed after each
instruction. With fast watchpoints, the debugger uses a hardware virtual
memory write protect mechanism to allow the program to run freely until
the variable being watched changes. The program being debugged stops
only when the virtual memory page containing the variable is written to. If
the value of the variable being watched does not changed, dbx continues the
execution of the process. If awrite modifies a watched variable, dbx notifies
you of the change.
Consider a small program that contains a global variable called global:
stop global
This command causes the program to stop if the value of the variable global
changes. The program runs virtually at full speed until global gets assigned
a new value. Similarly, consider the command:
stop 0x100100
This command stops when the 32- bit integer residing at address 0x100100
is modified, and runs at nearly full speed until the value changes. This form
of the stop command is useful for watching the contents of anonymous
memory, such as the memory returned by malloc().