Publication date: 08/13/2020

Work with Breakpoints

A breakpoint interrupts the execution of a script. Although you can step through a script line by line, this can be tedious and lengthy for a long or complex script. You can set breakpoints at places of interest and simply run the script in the Debugger. The script is run normally until a breakpoint is reached. At the breakpoint, the Debugger stops executing the script so you can look at the values of variables or start stepping line by line.

Breakpoints that appear on the Breakpoints tab in the lower right corner watch for changes in a line. Breakpoints that appear on the Data Breakpoints tab watch for changes in variables.

JMP preserves breakpoints across sessions. So when you close and reopen JMP, the breakpoints still appear.

Tip: Turn on line numbers by right-clicking in the script and selecting Show Line Numbers. You can also show line numbers by default in all scripts by modifying the Script Editor preferences.

Create a Breakpoint

When creating a breakpoint, you can specify settings such as conditions and break behavior. To do so, click on the Breakpoints tab or Data Breakpoints tab, and then enter the breakpoint information.

Otherwise, create a quick breakpoint by doing one of the following:

In the Debugger margin, click the appropriate line (to the right of the line number if displayed).

In the Debugger margin, right-click in the margin where you want the breakpoint and select Set Breakpoint.

The red breakpoint icon appears where you inserted the breakpoint and on the Breakpoints tab.

Delete Breakpoints

Do one of the following:

In the Debugger margin, click the breakpoint icon.

In the Debugger margin, right-click the breakpoint icon and select Clear Breakpoint.

On the Breakpoints tab, select the breakpoint and then click .

On the Breakpoints tab, click to delete all breakpoints (not just the selected breakpoints).

The red breakpoint icon is removed, and the breakpoint no longer appears on the Breakpoints tab.

Disable and Enable Breakpoints

Disabling a breakpoint is helpful when you potentially fix a problem and then want to see whether the script will run correctly past that breakpoint. You can then enable the breakpoint when necessary rather than recreating it.

Do one of the following:

In the Debugger margin, right-click the breakpoint icon and select Enable Breakpoint or Disable Breakpoint.

On the Breakpoints tab, select or deselect the breakpoint’s check box.

On the Breakpoints tab, click to disable or enable all breakpoints.

A disabled breakpoint turns white; enabled breakpoints are shaded red.

Specify and Clear Conditional Expressions on Breakpoints

Setting a condition on a breakpoint is an alternative to single-stepping through code. Rather than single-step and view the variables for each expression, you specify that the script break only when a condition is met. Then you can step through the code and figure out where the problem arises.

Suppose that a calculation in your script is incorrect, and you suspect the problem occurs when i==19. Set a conditional breakpoint for i==18. The Debugger will run until that condition is met, then you can step through the code to identify the problem.

Specify a Breakpoint Condition

1. Right-click the breakpoint icon and select Edit Breakpoint.

2. On the Condition tab, select Condition and enter the conditional expression.

3. Specify whether to break when the expression Is true or Has Changed.

4. Click OK.

Disable or Enable a Condition

1. Right-click the breakpoint icon and select Edit Breakpoint.

2. On the Condition tab, deselect or select Condition.

Delete a Condition

On the Breakpoints tab, click in the breakpoint’s Condition field and press DELETE.

Specify Break Options

Right-clicking the breakpoint and selecting Edit Breakpoint provides a quick way to manage breakpoint behavior. Alternatively, select the breakpoint on the Breakpoints tab and click . Both methods display the Breakpoint Information window, where you customize settings on the Hit Count and Action tabs.

Change the Hit Count

You can control the number of times a breakpoint must be hit and when the break occurs. For example, to break when the condition is met twice, select break when the hit count is equal to and type 2 on the Hit Count tab.

Define an Action

You also have the option of defining a JSL expression or script that the Debugger executes when a breakpoint is hit and execution has stopped. This script is called an action. On the Action tab, enter the JSL expression to be executed.

Run the Script to the Cursor

When you right-click and select Run To Cursor, all expressions before the location of the cursor are executed. Select this option when you only want to see values up to the current line. To see values when each expression is executed, use the stepping options.

Tips for Setting Breakpoints

If you do not want to watch for errors in a specific loop, set a breakpoint after the loop ends. The Debugger will hit the next breakpoint rather than stepping through each line of the loop.

Avoid inserting a breakpoint in lines that do not trigger an action (such as comments, blank lines, and end parentheses). Debugger will not break on these lines.

When you insert breakpoints, close Debugger, and edit the script, the breakpoints remain on the original line numbers. You might need to delete and then reinsert the breakpoints.

Breakpoints are remembered across Debugger sessions. This means that your breakpoints list includes breakpoints that have been set in all scripts, not just the script that you are currently debugging.

Breakpoints are remembered by the Debugger session, not by each script. This means that breakpoints are listed even for scripts that have been moved or deleted.

On the Breakpoints tab, click to remove all breakpoints in scripts whether they are currently open or not, or for scripts that no longer exist.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).
.