Watchpoints (Native COBOL)

  • 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:

  1. In the Activity bar, click to open the Run and Debug panel, then click the row for WATCHPOINTS.
  2. Click +.
  3. 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.

  4. You can toggle this watchpoint on and off by clicking Toggle Enable Watchpoint on the line for the watchpoint in the WATCHPOINTS window.

Optionally, to add a condition to the watchpoint:

  1. Click on the item in the WATCHPOINTS panel, and expand it.

    The watchpoint conditions item is displayed.

  2. On the row for the condition, click one of the following buttons:
    • Edit Condition Expression - this starts the command palette for you to type 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 will not work.)
    • Edit hit count - this starts the command palette and opens a drop-down list for you to select a criteria, then enter the appropriate value. This represents the number of times that the area of memory is updated.

    If you define both an expression and a hit count value, both criteria must be satisfied before execution will halt.

  3. 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.