Using SoftBench Debugger
Setting and Using WatchpointsSetting and Using Watchpoints
Watchpoints allow you to monitor the value of an expression, or the contents of a range of memory, while your program executes. SoftBench Debugger checks the value (as often as specified in the watchpoint definition), notifies you when it changes, and pauses your program.
This can be extremely useful when searching for "mystery" errors. For example, suppose at some unknown time your program corrupts an important area in memory. Without watchpoints, it would be very difficult to determine exactly when the corruption occurred. Using watchpoints, you can quickly find when the corruption happens, which gives you a good idea of what caused it.
When you create a watchpoint, you specify the expression or address range to monitor, and an option to specify "granularity". Granularity specifies how often the value of interest should be monitored:
•At every procedure entry
•At every procedure exit
•At the entry and exit of every procedure
•Every statement
•Every assembly instruction
•whenever the program stops and returns control to the debugger
The Watchpoint dialog setting defaults to "Stop". This default allows you to monitor the current values of some data items when debugging a program.
Be certain you specify an appropriate granularity. If you want SoftBench Debugger to watch a variable while your program runs, you should not have the "❍ Stop" radio button active in the "Set At" area. This setting only checks your watchpoints when your program reaches a breakpoint or is interrupted for another reason. You should specify a procedure- or
Chapter 7 | 199 |