### 8.6 The Edwin Debugger ¶

The Edwin debugger is similar to the command-line debugger, except that it takes advantage of multiple windows and Edwin’s command structure to provide a more intuitive interface. The debugger operates as a browser, much like Dired, presenting you with an overview of the subproblem structure, and allowing you to examine parts of that structure in more detail by selecting the parts. When started, the debugger creates a buffer ‘`*debug*`’ showing the subproblem structure, and selects the first line.

Each line beginning with ‘`S`’ represents either a subproblem or stack frame. A subproblem line may be followed by one or more indented lines (beginning with the letter ‘`R`’) which represent reductions associated with that subproblem. The subproblems are indexed with the natural numbers. To obtain a more complete description of a subproblem or reduction, click the mouse on the desired line or move the cursor to the line using the arrow keys (or `C-n` and `C-p`). The description buffer will display the additional information.

The description buffer contains three major regions. The first region contains a pretty-printed version of the current expression. The current subproblem within the expression is highlighted. The second region contains a representation of the frames of the environment of the current expression. The bindings of each frame are listed below the frame header. If there are no bindings in the frame, none will be listed. The frame of the current expression is preceded with ‘`==>`’.

The bottom of the description buffer contains a third region for evaluating expressions in the environment of the selected subproblem or reduction. This is the only portion of the buffer where editing is possible. This region can be used to find the values of variables in different environments, or even to modify variable values or data structures (note that variables in compiled code cannot usually be modified).

Typing `e` creates a new buffer in which you may browse through the current environment. In this new buffer, you can use the mouse, the arrows, or `C-n` and `C-p` to select lines and view different environments. The environments listed are the same as those in the description buffer. If the selected environment structure is too large to display (i.e. if the number of bindings in the environment exceeds the value of the editor variable `environment-package-limit`) a message to that effect is displayed. To display the environment in this case, use `M-x set-variable` to set `environment-package-limit` to `#f`. At the bottom of the new buffer is a region for evaluating expressions, similar to that of the description buffer.

The appearance of environment displays is controlled by the editor variables `debugger-show-inner-frame-topmost?` and `debugger-compact-display?` which affect the ordering of environment frames and the line spacing respectively.

Type `q` to quit the debugger, killing its primary buffer, any others that it has created, and the window that was popped up to show the debugger.

Note: The description buffers created by the debugger are given names beginning with spaces so that they do not appear in the buffer list; these buffers are automatically deleted when you quit the debugger. If you wish to keep one of these buffers, simply rename it using `M-x rename-buffer`: once it has been renamed, it will not be automatically deleted.