5.4.6 Electric Debug Mode

Even with a convenient debug key prefix enabled, repetitive stepping, variable examination (see Examining Variables), and other debugging activities can be awkward and slow using commands which require multiple keystrokes. Luckily, there’s a better way, inspired by the lisp e-debug mode, and available through the Electric Debug Mode. By default, as soon as a breakpoint is hit, this minor mode is enabled. The buffer showing the line where execution has halted is switched to Electric Debug Mode. This mode is visible as ‘*Debugging*’ in the mode line, and a different face (violet by default, if color is available) for the line stopped at point. The buffer is made read-only and single-character bindings for the most commonly used debugging commands are enabled. These character commands (a list of which is available with C-?) are:

aClear all breakpoints (idlwave-shell-clear-all-bp)
bSet breakpoint, C-u b for a conditional break, C-n b for nth hit (idlwave-shell-break-here)
dClear current breakpoint (idlwave-shell-clear-current-bp)
ePrompt for expression to print (idlwave-shell-clear-current-bp).
hContinue to the line at cursor position (idlwave-shell-to-here)
iSet breakpoint in module named here (idlwave-shell-break-in)
[Go to the previous breakpoint in the file (idlwave-shell-goto-previous-bp)
]Go to the next breakpoint in the file (idlwave-shell-goto-next-bp)
\Disable/Enable current breakpoint (idlwave-shell-toggle-enable-current-bp)
jSet breakpoint at beginning of enclosing routine (idlwave-shell-break-this-module)
kSkip one statement (idlwave-shell-skip)
mContinue to end of function (idlwave-shell-return)
nStep, over function calls (idlwave-shell-stepover)
oContinue past end of function (idlwave-shell-out)
pPrint expression near point or in region with C-u p (idlwave-shell-print)
qEnd the debugging session and return to the Shell’s main level (idlwave-shell-retall)
rContinue execution to next breakpoint, if any (idlwave-shell-cont)
s or SPACEStep, into function calls (idlwave-shell-step)
tPrint a calling-level traceback in the shell
uContinue to end of block (idlwave-shell-up)
vTurn Electric Debug Mode off (idlwave-shell-electric-debug-mode)
xExamine expression near point (or in region with C-u x) with shortcut of examine type.
zReset IDL (idlwave-shell-reset)
+ or =Show higher level in calling stack (idlwave-shell-stack-up)
- or _Show lower level in calling stack (idlwave-shell-stack-down)
?Help on expression near point or in region with C-u ? (idlwave-shell-help-expression)
C-?Show help on the commands available.

Most single-character electric debug bindings use the final keystroke of the equivalent multiple key commands (which are of course also still available), but some differ (e.g., e,t,q,x). Some have additional convenience bindings (like SPACE for stepping). All prefix and other argument options described in this section for the commands invoked by electric debug bindings are still valid. For example, C-u b sets a conditional breakpoint, just as it did with C-u C-c C-d C-b.

You can toggle the electric debug mode at any time in a buffer using C-c C-d C-v (v to turn it off while in the mode), or from the Debug menu. Normally the mode will be enabled and disabled at the appropriate times, but occasionally you might want to edit a file while still debugging it, or switch to the mode for conveniently setting lots of breakpoints.

To quickly abandon a debugging session and return to normal editing at the Shell’s main level, use q (idlwave-shell-retall). This disables electric debug mode in all IDLWAVE buffers4. Help is available for the command shortcuts with C-?. If you find this mode gets in your way, you can keep it from automatically activating by setting the variable idlwave-shell-automatic-electric-debug to nil, or 'breakpoint. If you’d like the convenient electric debug shortcuts available also when run-time errors are encountered, set to t.

User Option: idlwave-shell-automatic-electric-debug ('breakpoint)

Whether to enter electric debug mode automatically when a breakpoint or run-time error is encountered, and then disable it in all buffers when the $MAIN$ level is reached (either through normal program execution, or retall). In addition to nil for never, and t for both breakpoints and errors, this can be 'breakpoint (the default) to enable it only at breakpoint halts.

User Option: idlwave-shell-electric-stop-color (Violet)

Default color of the stopped line overlay when in electric debug mode.

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

The face to use for the stopped line. Defaults to a face similar to the modeline, with color idlwave-shell-electric-stop-color.

User Option: idlwave-shell-electric-zap-to-file (t)

If set, when entering electric debug mode, select the window displaying the file where point is stopped. This takes point away from the shell window, but is useful for immediate stepping, etc.


Footnotes

(4)

Note that this binding is not symmetric: C-c C-d C-q is bound to idlwave-shell-quit, which quits your IDL session.