A watchpoint is a breakpoint that suspends execution whenever
a specified field is accessed or modified.
About this task
You can set watchpoints from the Variables view,
the Outline view, or the editor. Once set, you
can view and configure the properties of a watchpoint.
To add
a watchpoint from the editor, place the cursor in the line that declares
the field that you want to watch and select Run > Toggle
Watchpoint from the workbench menu bar. If a breakpoint
is already set for the field, then the breakpoint will be removed.
If there is no breakpoint for the field, then the breakpoint will
be created. Once the breakpoint is created, a new watchpoint marker
is displayed in both the Breakpoints view and
in the editor the marker bar (directly to the left of the field where
you added the breakpoint).
Procedure
To add a watchpoint from the Variables view
or Outline view:
- Locate and select the field in either view.
- Perform one of the following tasks:
- Right-click the field and select Toggle Watchpoint from
the pop-up menu.
- Choose Run > Toggle Watchpoint from
the workbench menu bar
- If a breakpoint is already set for the field, then the
breakpoint will be removed. If there is no breakpoint for the field,
then the breakpoint will be created. Once the breakpoint is created,
a new watchpoint marker is displayed in both the Breakpoints view
and in the editor the marker bar (directly to the left of the field
where you added the breakpoint).
Results
Note: When you select a field in the editor, Outline view,
or Variables view, the Run > Toggle
Watchpoint workbench menu item is only available while
the view or editor is in focus.