Adding watchpoints
A watchpoint is a special breakpoint that stops the execution of an
application whenever the value of a given expression changes, without specifying
where this may happen. Unlike breakpoints which are line-specific watchpoints
are associated with files. They take effect whenever a specified condition is
true regardless of when or where it occurred.
To add a watchpoint:
- Click Run > Add C/C++ Watchpoint.
- If Add C/C++ Watchpoint is not listed on the Run menu, select Window
> Customize Perspective.
- In the Customize Perspective dialog
box, expand Other in the Available Items list.
- Select the C/C++ Debug check box. Click OK.
- In the Add C/C++ Watchpoint dialog box, type an expression in the Expression to watch
box. The
expression may be anything that can be evaluated inside an if
statement.
- Do any of the following:
- To stop execution when the watch expression is read, select the
Read check box.
- To stop execution when the watch expression is written to, select the Write
check box.
- In the C/C++ editor, open the file that you added the watchpoint to.
- Click OK.
- The watchpoint appears in the Breakpoints view
list.
C/C++ Development perspective
Projects
Working with breakpoints and watchpoints
Run and Debug dialog box