idlwave: Electric Debug Mode

 
 5.4.6 Electric Debug Mode
 -------------------------
 
 Even with a convenient debug key prefix enabled, repetitive stepping,
 variable examination (SeeExamining 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:
 
 ‘a’            Clear all breakpoints (‘idlwave-shell-clear-all-bp’)
 ‘b’            Set breakpoint, ‘C-u b’ for a conditional break, ‘C-n b’
                for nth hit (‘idlwave-shell-break-here’)
 ‘d’            Clear current breakpoint
                (‘idlwave-shell-clear-current-bp’)
 ‘e’            Prompt for expression to print
                (‘idlwave-shell-clear-current-bp’).
 ‘h’            Continue to the line at cursor position
                (‘idlwave-shell-to-here’)
 ‘i’            Set 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’)
 ‘j’            Set breakpoint at beginning of enclosing routine
                (‘idlwave-shell-break-this-module’)
 ‘k’            Skip one statement (‘idlwave-shell-skip’)
 ‘m’            Continue to end of function (‘idlwave-shell-return’)
 ‘n’            Step, over function calls (‘idlwave-shell-stepover’)
 ‘o’            Continue past end of function (‘idlwave-shell-out’)
 ‘p’            Print expression near point or in region with ‘C-u p’
                (‘idlwave-shell-print’)
 ‘q’            End the debugging session and return to the Shell’s main
                level (‘idlwave-shell-retall’)
 ‘r’            Continue execution to next breakpoint, if any
                (‘idlwave-shell-cont’)
 ‘s’ or         Step, into function calls (‘idlwave-shell-step’)
 ‘<SPACE>’
 ‘t’            Print a calling-level traceback in the shell
 ‘u’            Continue to end of block (‘idlwave-shell-up’)
 ‘v’            Turn Electric Debug Mode off
                (‘idlwave-shell-electric-debug-mode’)
 ‘x’            Examine expression near point (or in region with ‘C-u
                x’) with shortcut of examine type.
 ‘z’            Reset 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 buffers(1).  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 ----------
 
    (1) Note that this binding is not symmetric: ‘C-c C-d C-q’ is bound
 to ‘idlwave-shell-quit’, which quits your IDL session.