Using Breakpoints & Watchpoint
Adding breakpoints
A breakpoint is set on an executable line of a program. If the breakpoint is enabled when you debug, the execution suspends before that line of code executes.
To add a breakpoint point, double click the marker bar located in the left margin of the C/C++ Editor beside the line of code where you want to add a breakpoint. A dot is displayed in the marker bar and in the Breakpoints view, along with the name of the associated file.
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 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.
To set a watchpoint on a global variable:
- Highlight the variable in the editor.
- Click Debug > Toggle Watchpoint
- 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:
- 4. The watchpoint appears in the Breakpoints view list.
|