5.4.3 Breakpoints and Stepping

IDLWAVE helps you set breakpoints and step through code. Setting a breakpoint in the current line of the source buffer is accomplished with C-c C-d C-b (idlwave-shell-break-here). With a prefix arg of 1 (i.e., C-1 C-c C-d C-b), the breakpoint gets a /ONCE keyword, meaning that it will be deleted after first use. With a numeric prefix greater than one (e.g., C-4 C-c C-d C-b), the breakpoint will only be active the nth time it is hit. With a single non-numeric prefix (i.e., C-u C-c C-d C-b), prompt for a condition: an IDL expression to be evaluated and trigger the breakpoint only if true. To clear the breakpoint in the current line, use C-c C-d C-d (idlwave-clear-current-bp). When executed from the shell window, the breakpoint where IDL is currently stopped will be deleted. To clear all breakpoints, use C-c C-d C-a (idlwave-clear-all-bp). Breakpoints can also be disabled and re-enabled: C-c C-d C-\ (idlwave-shell-toggle-enable-current-bp).

Breakpoint lines are highlighted or indicated with an icon in the source code (different icons for conditional, after, and other break types). Disabled breakpoints are grayed out by default. Note that IDL places breakpoints as close as possible on or after the line you specify. IDLWAVE queries the shell for the actual breakpoint location which was set, so the exact line you specify may not be marked. You can re-sync the breakpoint list and update the display at any time (e.g., if you add or remove some on the command line) using C-c C-d C-l.

In recent IDLWAVE versions, the breakpoint line is highlighted when the mouse is moved over it, and a tooltip pops up describing the break details. mouse-3 on the breakpoint line pops up a menu of breakpoint actions, including clearing, disabling, and adding or changing break conditions or “after” break count.

Once the program has stopped somewhere, you can step through it. The most important stepping commands are C-c C-d C-s to execute one line of IDL code ("step into"); C-c C-d C-n to step a single line, treating procedure and function calls as a single step ("step over"); C-c C-d C-h to continue execution to the line at the cursor and C-c C-d C-r to continue execution. See Commands Sent to the Shell, for information on displaying or hiding the breakpoint and stepping commands the shell receives. Here is a summary of the breakpoint and stepping commands:

C-c C-d C-bSet breakpoint (idlwave-shell-break-here)
C-c C-d C-iSet breakpoint in module named here (idlwave-shell-break-in)
C-c C-d C-dClear current breakpoint (idlwave-shell-clear-current-bp)
C-c C-d C-aClear all breakpoints (idlwave-shell-clear-all-bp)
C-c C-d [Go to the previous breakpoint (idlwave-shell-goto-previous-bp)
C-c C-d ]Go to the next breakpoint (idlwave-shell-goto-next-bp)
C-c C-d C-\Disable/Enable current breakpoint (idlwave-shell-toggle-enable-current-bp)
C-c C-d C-jSet a breakpoint at the beginning of the enclosing routine.
C-c C-d C-sStep, into function calls (idlwave-shell-step)
C-c C-d C-nStep, over function calls (idlwave-shell-stepover)
C-c C-d C-kSkip one statement (idlwave-shell-skip)
C-c C-d C-uContinue to end of block (idlwave-shell-up)
C-c C-d C-mContinue to end of function (idlwave-shell-return)
C-c C-d C-oContinue past end of function (idlwave-shell-out)
C-c C-d C-hContinue to line at cursor position (idlwave-shell-to-here)
C-c C-d C-rContinue execution to next breakpoint, if any (idlwave-shell-cont)
C-c C-d C-upShow higher level in calling stack (idlwave-shell-stack-up)
C-c C-d C-downShow lower level in calling stack (idlwave-shell-stack-down)

All of these commands have equivalents in Electric Debug Mode, which provides faster single-key access (see Electric Debug Mode).

The line where IDL is currently stopped, at breakpoints, halts, and errors, etc., is marked with a color overlay or arrow, depending on the setting in idlwave-shell-mark-stop-line. If an overlay face is used to mark the stop line (as it is by default), when stepping through code, the face color is temporarily changed to gray, until IDL completes the next command and moves to the new line.

User Option: idlwave-shell-mark-breakpoints (t)

Non-nil means mark breakpoints in the source file buffers. The value indicates the preferred method. Valid values are nil, t, face, and glyph.

User Option: idlwave-shell-breakpoint-face

The face for breakpoint lines in the source code if idlwave-shell-mark-breakpoints has the value face.

User Option: idlwave-shell-breakpoint-popup-menu (t)

Whether to pop-up a menu and present a tooltip description on breakpoint lines.

User Option: idlwave-shell-mark-stop-line (t)

Non-nil means mark the source code line where IDL is currently stopped. The value specifies the preferred method. Valid values are nil, t, arrow, and face.

User Option: idlwave-shell-overlay-arrow (">")

The overlay arrow to display at source lines where execution halts, if configured in idlwave-shell-mark-stop-line.

User Option: idlwave-shell-stop-line-face

The face which highlights the source line where IDL is stopped, if configured in idlwave-shell-mark-stop-line.