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.
BREAKPOINT [, File], Index [, AFTER=integer] [, /CLEAR] [, CONDITION=‘expression’] [, /DISABLE] [, /ENABLE] [, /ON_RECOMPILE] [, /ONCE] [, /SET]
An optional string argument that contains the name of the source file. If File is not supplied, the Index agrument is interpreted as an index into the list of current breakpoints as reported by HELP, /BREAKPOINT.
If File is not in the current directory, the full path name must be specified even if File is in one of the directories specified by !PATH.
If the File argument is specified, Index is the line number at which to clear or set a breakpoint.
If the File argument is not specified, Index is the index into the list of current breakpoints as reported by HELP, /BREAKPOINT.
Set this keyword equal to an integer n. Execution will stop only after the nth time the breakpoint is hit. For example:
BREAKPOINT, /SET, 'test.pro', 8, AFTER=3
This 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
BREAKPOINT, /CLEAR, 'test.pro',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. For example:
BREAKPOINT, 'myfile.pro', 6, CONDITION='i gt 2'
If i is greater than 2 at line 6 of myfile.pro, the program is interrupted.
Set this keyword to disable the specified breakpoint, if it exists. The breakpoint can be specified using the breakpoint index or file and line number:
BREAKPOINT, /DISABLE, 3
BREAKPOINT, /DISABLE, 'test.pro',8
Set this keyword to enable the specified breakpoint if it exists. The breakpoint can be specified using the breakpoint index or file and line number:
BREAKPOINT, /ENABLE, 3
BREAKPOINT, /ENABLE, 'test.pro',8
Set this keyword to specify that the breakpoint will not take effect until the next time the file containing it is compiled.
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:
BREAKPOINT, /SET, 'xyz.pro', 23