The BREAKPOINT procedure allows you to insert and remove breakpoints in programs for debugging. A breakpoint causes program execution to stop after the designated statement is executed. Breakpoints are specified using the source file name and line number. For multiple-line statements (statements containing "$", the continuation character), specify the line number of the last line of the statement.
You can insert breakpoints in programs without editing the source file. Enter the following
:
to display the breakpoint table which gives the index, module and source file locations of each breakpoint.
Set this keyword equal to an integer n . Execution will stop only after the n th time the breakpoint is hit. For example:
BREAKPOINT, /SET, 'test.pro', 8, AFTER=3
sets a breakpoint at the eighth line of the file
test.pro
, but only stops execution after the breakpoint has been encountered three times.
Set this keyword to remove a
breakpoint. The breakpoint to be removed is specified either by index, or by the source file and line number. Use command
HELP, /BREAKPOINT
to display the indices of existing breakpoints. For example:
BREAKPOINT, /CLEAR, 3 ; Clear breakpoint with an index of 3.
BREAKPOINT, /CLEAR, 'test.pro',8 ; Clear the breakpoint corresponding to the statement in the file test.pro, line number 8.
Set this keyword to a string containing an IDL expression. When a breakpoint is encountered, the expression is evaluated. If the expression is true (if it returns a non-zero value), program execution is interrupted. The expression is evaluated in the context of the program containing the breakpoint.
; If i is greater than 2 at line 6 of myfile.pro, the program is interrupted.
Set this keyword to make the breakpoint temporary. If ONCE is set, the breakpoint is cleared as soon as it is hit. For example:
BREAKPOINT, /SET, 'file.pro', 12, AFTER=3, /ONCE
sets a breakpoint at line 12 of
file.pro
. Execution stops when line 12 is encountered the third time, and the breakpoint is automatically cleared.
Set this keyword to set a breakpoint at the designated source file line. If this keyword is set, the first input parameter, File must be a string expression that contains the name of the source file. The second input parameter must be an integer that represents the source line number.
For example, to set a breakpoint at line 23 in the source file
xyz.pro
, enter: