Adding watchpoints

A watchpoint is a special breakpoint that stops the execution of an application whenever the value of a given expression changes. There are several ways to set a watchpoint in the CDT debugger.

To set a watchpoint on a global variable

  1. Select a variable in the Outline view or the C/C++ Project view.
  2. Click Run > Toggle Watchpoint or select Toggle Watchpoint from the variable's pop-up menu.
  3. In the Add Watchpoint dialog box, do any of the following:
  4. Click OK.
  5. The watchpoint appears in the Breakpoints view list.
Repeating the steps 1-2 on the same variable will remove the watchpoint.

To set a watchpoint on an arbitrary expression

  1. Open the Breakpoints view.
  2. Select Add Watchpoint from the view's context menu.
  3. In the Add Watchpoint (C/C++) dialog box, type an expression in the Expression to watch field. The expression may be anything that can be evaluated to an address.
  4. Follow the step 3-4 from above.

Related concepts
C/C++ Development perspective

Related tasks
Working with breakpoints and watchpoints

Related reference
Run and Debug dialog box

IBM Copyright Statement