Breakpoints

Old Content - visit altium.com/documentation

The following content has been imported from Legacy Help systems and is in the process of being checked for accuracy.

Function

The Breakpoints panel provides information on all breakpoints that are currently defined in all open script files (irrespective of the parent script project (*.PrjScr) they belong to), as well as providing commands for adding, enabling, disabling and deleting selected breakpoints as required.

Content and Use

Any breakpoints that are currently defined in any open script documents (*.pas, *.vbs, *.js, *.tcl, *.bas) will be listed in the panel. For each breakpoint entry, the following information is available:

  • Module name - the name of the script file (including path) in which the breakpoint resides
  • Line - the line number within the script document at which the breakpoint has been placed
  • Condition - any specific condition defined for the breakpoint. If a condition has been specified, the breakpoint is referred to as a 'conditional breakpoint', whereby execution of the script will only halt if the condition returns true, otherwise execution will proceed unchecked.

A small icon to the left of the Module name is used to indicate the status of the breakpoint:

-

Breakpoint currently enabled

-

Breakpoint currently disabled

The icons used to mark breakpoints on the source code document itself are slightly different:

  • Enabled breakpoint - indicated in the code by a red highlight over the breakpoint line and a red circle with a cross in the margin
  • Disabled breakpoint - indicated in the code by a green highlight over the breakpoint line and a green circle with a cross in the margin


Double-clicking on a breakpoint entry in the panel will make the associated script document the active document in the design editor window, placing the text cursor at the beginning of the line of script to which the breakpoint applies.

Right-click Menu

When you select a breakpoint entry in the panel and right-click, a pop-up menu will appear providing the following commands:

  • Enable - toggle the state of the selected breakpoint between enabled and disabled
  • Delete - delete the selected breakpoint
  • View Source - make the associated script document, in which the selected breakpoint resides, the active document in the design editor window
  • Edit Source - make the associated script document, in which the selected breakpoint resides, the active document in the design editor window and place the text cursor at the beginning of the line, ready for editing

  • Properties - access the Breakpoint Properties dialog for the selected breakpoint entry.

You can use this dialog to change the state of the breakpoint (enable/disable it) and also add/modify a condition for the breakpoint as required. You cannot change the file in which the breakpoint has been added, nor the specific line number within that file.

  • Breakpoints sub-menu - provides access to the Add, Delete All, Disable All and Enable All commands listed below

When you right-click in the panel - away from breakpoint entries - a pop-up menu will appear providing the following commands:

  • Add - use this command to access the Add New Breakpoint dialog.

Use the dialog to define in which of the open script documents (listed under the File Name drop-down) and at what line number within that document, a new breakpoint should be added. You can also define a condition for the breakpoint and its initial state when placed - enabled or disabled. After defining the breakpoint as required, clicking OK will add the breakpoint to the designated document. The Breakpoints panel will be updated accordingly, with a new entry added at the bottom of the existing list of entries.

  • Delete All - delete all currently defined breakpoints listed in the panel
  • Disable All - change the current state of all breakpoints listed in the panel to disabled
  • Enable All - change the current state of all breakpoints listed in the panel to enabled

Notes

  • A breakpoint tells the Script Interpreter to pause its execution of a script at a particular line. Include a breakpoint in your script when you wish to halt execution at a particular point. A typical use of breakpoints would be in the different branches of a conditional statement, where a breakpoint is inserted into each branch to check which one is executed.
  • Enabled breakpoints can be added directly to a source script document by clicking in the right-hand margin, next to the line that you wish to apply a breakpoint to. Clicking again will remove the breakpoint. Alternatively, use the Toggle Breakpoint command, available from the Run menu or Script Debug toolbar. The Breakpoints panel will update accordingly.
  • A disabled breakpoint remains defined but will not cause a running script to halt when encountered.
  • A disabled breakpoint cannot be removed directly from the script document - neither by clicking in the right-hand margin nor by using the Toggle Breakpoint command. In the disabled state, deletion is only possible from the Breakpoints panel.
  • Any breakpoints that are set on non-statement lines of the script (e.g. blank lines, commented lines, etc) will, although displayed as valid and listed as enabled (or disabled) in the Breakpoints panel, be treated as invalid by the Script Interpreter and therefore ignored.
  • The keyboard shortcuts Up Arrow (or Left Arrow), HOME, END and Down Arrow (or Right Arrow), can be used to select the previous, first, last and next breakpoint entry, respectively.
  • You can change the order in which columns are displayed. To move a column, click on its header and drag it horizontally to the required position. A valid position is indicated by the appearance of two green positional arrows.
  • To continue execution of a program that has been halted at a breakpoint, use the Run command, available from the Run menu or Script Debug toolbar (shortcut F9), or use the single stepping commands.

See Also

You are reporting an issue with the following selected text and/or image within the active document: