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:
- Select the variable in the Source Editor.
- 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.
- Specify the breakpoint settings:
- Package Name, Class name, and Field Name. If these fields are not already filled in, enter the desired information.
- Stop on. Specify the action that triggers the breakpoint. Variable Access stops your program when it queries a variable in the specified class and field. Variable Modification stops your program when the value of the variable changes.
- Condition. To set a condition so the breakpoint occurs when an expression evaluates to true, type a Boolean expression in this text field.
For information on the syntax rules for setting a condition, see Conditional Breakpoints.
- Specify the actions to take when the breakpoint is hit:
-
Suspend Debugging. If selected, all threads in the debugging session are temporarily stopped when the program reaches the breakpoint.
- Print Text. If selected, the specified message is printed in the Output window
when the breakpoint is hit. You can use a combination of text,
substitution codes, curly braces and a dollar sign in the message.
An example is {$mywatch}.
- Click OK.
The breakpoint is added to the Breakpoints view of the Debugger
window.
Legal Notices