Setting conditional breakpoints and watchpoints

Conditional breakpoints and conditional watchpoints only break execution when a coded condition or a hit count is satisfied. You can combine both a condition and a hit count, where both must be satisfied before execution will break.

To set a conditional breakpoint or watchpoint:

  1. Set a breakpoint or watchpoint using one of the methods outlined in Using breakpoints and watchpoints.
  2. Right-click the breakpoint icon (breakpoint marker), method breakpoint icon (method breakpoint), or watchpoint icon (watchpoint marker) in the marker bar, and then select Breakpoint Properties.

    This opens a Properties dialog box.

  3. Depending on your program type, configure the conditional properties:
    • Native COBOL:
      1. To add a hit count, select Hit count, click hit count operator icon and select the required operator, and then enter the required value.
      2. To add a condition, click Condition, and then in the Conditional statement field, type your statement.
        Tip: To help you construct a condition, press Ctrl + Space to display the code assist list: a list of valid COBOL syntax and defined data items.
    • JVM COBOL:
      Note: Enabled is selected by default; to configure the condition, but temporarily disable it from the program, clear the check box.
      1. To configure the breakpoint or watchpoint as a trigger point, select Trigger Point. If trigger points exist, all other breakpoints/watchpoints are disabled until a trigger point is hit.
      2. To add a hit count, select Hit count, enter a positive integer, and then select the required outcome when the integer is hit.
      3. (Breakpoints only) To mark the breakpoint as conditional, select Conditional, and then in the pane below, type the condition.
        Tip: The following types of condition are supported:
        • variable-name = "ABCD"
        • variable-name(idx) = "ABCD"
        • variable-name
        • level-88-name
        [13]
      4. Select the required criteria for the condition:
        • Suspend when true if you have specified a conditional expression; e.g. variable-name(idx) = "ABCD".
        • Suspend when value changes if you have specified a variable.
  4. Click Apply and Close.

    The conditional breakpoint or watchpoint is set, as indicated in the marker bar, and will be in effect the next time you debug the application.

    When debugging conditional watchpoints, since execution breaks when the item has been changed, the cursor position will be on the statement after the statement that caused the data item to change value.