3. Use Breakpoints

Select breakpoints.

Run the Debugger.

Remove breakpoints.

If you only need to debug one or more portions of a long script one or more breakpoints can be set at selected lines in your script.

Valid breakpoints can only be set on lines in your script that contain code, including lines in functions and subroutines. Although you can set a breakpoint anywhere within a script prior to execution, when you compile and run the script, invalid breakpoints (breakpoints on lines that don't contain code) are automatically removed. While you are debugging your script, the Program Editor will beep if you try to set a breakpoint on a line that does not contain code.

  1. Select Breakpoints

  1. Place the insertion point in the line where you want to do one of the following.

A select point.

A line outside the current subroutine.

Selected portions of a program.

  1. Do one of the following.

1

Click the Breakpoint button on the Application toolbar.

2

Click Debug>Toggle Breakpoint on the Program Editor menu bar.

3

Press F9 on the keyboard.

  1. Repeat the process to set as many breakpoints as needed, up to 255.

Result: The script is ready to be debugged.

  1. Run the Debugger

Do any of the following.

A

Click the Start button on the Application toolbar.

B

Click Run>Start on the Program Editor menu bar.

D

Press F5 on the keyboard.

Results

A breakpoint was inserted at:

A select point

The Program Editor:

Runs the script at full speed until it reaches the line containing the breakpoint and then pauses with the instruction pointer on that line.

The line will be executed next when you either proceed with debugging or resume running the script.

If you want to continue debugging at another line in your script, you can use the Set Next Statement command in the Debug menu to move the instruction pointer to the desired line—provided the line is within the same subroutine.

A line outside the current subroutine

Runs the script at full speed until it reaches the line containing the breakpoint and then pauses with the instruction pointer on that line.

You can now resume stepping through your script from that point.

Selected portions of a program

Runs the script at full speed until it reaches the line containing the first breakpoint and then pauses with the instruction pointer on that line.

  1. Step through as much of the code as you need to.

  2. To resume running your script, click the Start button on the toolbar or press F5.

The script executes at full speed until it reaches the line containing the second breakpoint and then pauses with the instruction pointer on that line.

  1. Repeat 1 and 2 until you have finished debugging the selected portions of your script.

  1. Remove breakpoints

Breakpoints can be removed either manually or automatically.

Remove a single breakpoint manually

  1. Place the insertion point on the line containing the breakpoint that you want to remove.

  2. Do one of the following.

Click the Toggle Breakpoint button on the Application toolbar.

Press F9 on the keyboard.

Result: The breakpoint is removed, and the line no longer displays in contrasting type.

Remove all breakpoints manually

Click Debug>Clear All Breakpoints on the Program Editor menu bar.

Result: The Program Editor removes all breakpoints from your script.

Note: Breakpoints are removed automatically under the following circumstances:

When a script is compiled and executed, breakpoints are removed from lines that don't contain code.

When you exit from the Program Editor, all breakpoints are cleared.

More information

Debug scripts.