BREAKPOINT

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 :

HELP, /BREAKPOINT

to display the breakpoint table which gives the index, module and source file locations of each breakpoint.

Calling Sequence

BREAKPOINT [, File], Index

Arguments

File

An optional string argument that contains the name of the source file. Note that 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.

Index

The line number at which to clear or set a breakpoint.

Keywords

AFTER

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.

CLEAR

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.

CONDITION

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.

ONCE

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

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

See Also

.