Using SoftBench Debugger

Setting and Using Watchpoints

For performance purposes, you should set the granularity as coarsely as possible. For example, if you only need to know the value of the monitored expression each time you enter a procedure, there is no sense in monitoring it after every assembly instruction. Typically you would locate a problem by using a granularity of "Proc Entry+Exit" to narrow the source of the problem down to one procedure. Once the problem is localized, use a finer granularity (such as "Statement" or "Instruction") but limit it to the offending procedure by entering the procedure name in the "When In" input box on the "Data Watchpoint Set/Change" dialog box.

In many other ways, watchpoints are similar to breakpoints. In addition to stopping the program, as a breakpoint does, a watchpoint also displays the new value of a changed variable. Nearly all other breakpoint concepts apply: watchpoints can be Active or Suspended, Verbose or Silent, and can have debugger commands associated with them. If you want the watchpoint to display changed values without stopping, you can enter the DDE command go in the "Commands" input box of the "Data Watchpoints" dialog box. Unlike breakpoints, watchpoints have no "Stop after Count" associated with them. See “Setting and Using Breakpoints” on page 189 for a description of these concepts.

Creating Watchpoints

As with breakpoints, SoftBench Debugger provides multiple ways to create watchpoints.

Using the Watch Menu

The "Watch" menu contains several entries that allow you to set a watchpoint associated with a token entered in the "()" input box.

For example, if you want to create a watchpoint associated with the variable counter, to be checked each time a procedure was entered, you could enter counter in the "()" input box and choose "Watch: Set at Entry ( )". See SoftBench Online Help for a description of these choices.

Using the "Data Watchpoint Set/Change" Dialog Box

This method is very general, and can be used to set watchpoints on any expression or any memory location with any allowable attributes. This method is the only way to set a watchpoint on a range of memory.

1. Choose "Watch: Set…".

200

Chapter 7

Page 200
Image 200
HP UX SoftBench Software Creating Watchpoints, Using the Watch Menu, Using the Data Watchpoint Set/Change Dialog Box, 200