Working with Breakpoints
A breakpoint is a marker in an IDL source code file that tells IDL to halt execution temporarily, allowing you to inspect the state of program variables in the program unit where the breakpoint occurred. Breakpoints allow you to control the flow of execution of your IDL program, stopping and starting at will.
Note
While you can set and use breakpoints in command-line mode using the BREAKPOINT routine and various Executive Commands, breakpoints are vastly more useful when working within graphical mode. See Debugging Tools for further information.
To experiment with breakpoints, do the following:
- In the IDL Workbench, type
- Edit the first program line to read as follows and then save and compile the program:
- Set a breakpoint in
broken.proby placing the cursor in the line that reads: - Now enter the following to execute the program:
- Inspect the value of the variable i by typing
PRINT, i*2and selecting Toggle Breakpoint from the Run menu or simply double-clicking on the line. A blue breakpoint dot appears next to the line.
BROKEN, 10The Console view displays the following:
10 % Breakpoint at: BROKEN 10and a current line indicator arrow stops at the breakpoint.
Note
When execution halts, you may see the Confirm Perspective Switch dialog.