A watchpoint is a special breakpoint that stops the execution of an
application whenever the value of a given expression changes, without specifying
where it might occur. 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. You can set a watchpoint on a global variable by highlighting the variable in the editor, or by selecting it in the Outline view.
To set a watchpoint on a global variable:
- Highlight the variable in the editor, or select it in the Outline view.
- Click Run > Toggle Watchpoint.
- Do any of the following:
The watchpoint appears in the Breakpoints view
- 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
C/C++ Development perspective
Using breakpoints and watchpoints
Run and Debug dialog box