Restriction:
- Watchpoints are supported only in native COBOL.
- This functionality requires a licensed version of a Micro Focus
Visual COBOL or
Enterprise Developer product on the same machine. See
Installation for details.
Watchpoints are a type of breakpoint for that you set on individual data items (not on lines of code). They enable you to
watch an area of memory associated with the particular item, and whilst debugging, execution breaks each time the associated
memory is updated, or if a condition is attached to the data item, when the condition and/or hit count setting is satisfied.
You can set watchpoints either before you start to debug or during your debug session.
Once a watchpoint is set, it is displayed and configured from the
WATCHPOINTS panel, where you can:
- Show a list of the watchpoints that have been set in code.
- Configure a conditional expression for a watchpoint; the expression can be based on the value of a data item, or based on
the number of times that the memory associated with the data item is updated.
- Add new watchpoints, and disable or delete existing ones.
- View the current state of each watchpoint during debugging.
To add a watchpoint:
- In the Activity bar, click
to open the Run and Debug panel, then click the row for
WATCHPOINTS.
- Click
+.
- Type the name of the data item in the field, and press
Enter.
The watchpoint is listed in
WATCHPOINTS window, and is enabled by default. You can toggle this watchpoint on and off by right-clicking and selecting
Toggle Enable Watchpoint.
Optionally, to add a condition to the watchpoint:
- Click on the item in the
WATCHPOINTS panel and expand it.
The watchpoint conditions item is displayed
- Right-click the condition, and then add one or both of the following:
-
Edit Condition Expression: a conditional expression, such as
variable EQUALS
value. (Bear in mind that 'Breaks when' is prefixed to your expression to form the complete expression. Also, there is no syntax
validation of your expression; if it is syntactically incorrect, it just won't work.)
-
Edit hit count: this represents the number of times that the area of memory is updated; click the current hit count criteria and select
from the list of criteria displayed, and then enter the appropriate value.
If you define both an expression and a hit count value, both criteria must be satisfied before execution will halt.
- You can toggle the conditions on and off by selecting
Toggle Enable Conditions. The check mark or X to the left of the condition indicates whether the condition is enabled.
When the watchpoint is enabled, debugging stops on the line that immediately follows the line on which the data has changed.