In This Book

Note that you use the 4Print ( )5 button on the expression &var to ￿nd the address of the variable var .

2. Select the granularity (how often the value is checked).
The default, Every Stop , causes the debugger to check values only when

3

target programexecution

stops for some

event like a breakpoint.

 

If you want target program execution to stop whenever the value changes, choose Statement granularity. Be aware, however, that Statement granularity can slow down performance of the target program.

You can also restrict a watchpoint to be active only in a speci￿ed block.

In C++ programs, you can specify how many levels of inherited data members should be included.

3.Control whether or not messages appear when a watchpoint is hit.4.Temporarily disable or re-activate watchpoints.

5.Specify the format in which the value is displayed. The default is to display the value as it is declared.

6.Specify debugger commands to execute when a watchpoint is hit.To see a listing of watchpoints, select Watch:Show .Using the watchpoint Command

The following command sets a watchpoint on the variable idx. By default, the watchpoint is in e￿ect at every statement in the program; that is, the debugger checks the value of idx after each program statement executes, and it stops program execution if the value of idx changes.

watchpoint idx

The initial value of \\test\print_msg\idx is 0 go

The value of \\test\print_msg\idx has changed from 0 to 9. Stopped at: \\test\print_msg\28

See Monitoring Memory Ranges in the online help for information on monitoring addresses with the watchpoint command.

Using Monitors (Breakpoints, Watchpoints, Traces, and Intercepts) 3-13