Setting a Breakpoint on a Variable
You can stop execution of your program whenever
a variable in a specific class and field is accessed
(for example, the method was called with the variable as an
argument) or modified.
To set a breakpoint on a variable:
- From the main menu, choose Debug
Add Breakpoint (Ctrl-Shift-F8).
- In the Add Breakpoint dialog box, select Variable from the Breakpoint
Type combo box.
- Type the class and field names in the text fields.
- From the Stop on combo box, select:
- Variable Access to stop your program when it queries a variable
in the specified class and field
-
Variable Modification to stop your program
when the value of the variable changes
- To set a condition (so the breakpoint occurs when an expression evaluates to
true), type the expression in the Condition text field.
- Select the desired actions:
-
Suspend debugging temporarily stops all threads in the debugging session when the program reaches the breakpoint.
-
Print text prints a message in the Output window
when program execution stops on the breakpoint. You can use a combination of text,
substitution codes, curly braces, and a dollar sign in the message
(for example,
{$mywatch}
).
- Click OK.
The breakpoint is added to the list in the Breakpoints tab of
the Debugger window.
Legal Notices