Set a Watchpoint (OS/2, Windows)

You can set a watchpoint (a storage change breakpoint) from any view that displays the contents of a portion of storage, for example a local variables view, monitored expressions view, or storage view. After the watchpoint is set, execution will stop each time the storage designated by the watchpoint is written to (or read, if you choose to set the watchpoint up for reads). To set a watchpoint, follow the steps below.

  1. If the variable's value is already displayed, skip to step 5.
  2. Select the variable in a source or declarations view
  3. Click mouse button 2, and select the object.
  4. From the resulting cascading menu, select Show Variable Value. A pane opens showing the variable value. Move the pointer to this pane.
  5. Click mouse button 2 on the expander for the variable, or on the contents of the variable if these are shown.
  6. Choose Set watchpoint.

You can set characteristics of the watchpoint, such as whether it applies to writes only, or to reads of the location as well, from a details view of the breakpoint:

  1. If a details view of the breakpoint is not already visible, click mouse button 2 on the watchpoint in the Breakpoints view of the Breakpoints page.
  2. In the Details view of the Breakpoints page, expand the watchpoint by clicking on the + icon to its left.
  3. Change the settings for the watchpoint by selecting appropriate radio buttons. You can change the number of bytes the watchpoint applies to, and whether the watchpoint stops execution only when the storage is written, or whenever the storage is either written or read.


Types of Breakpoints


Enable, Disable, or Delete Breakpoints from a Breakpoints View
Set Breakpoints Before Debugging
Set Breakpoints Within Debug Pages