Next: , Previous: Working with GDS in Scheme Buffers, Up: Using Guile in Emacs


3.5.5 Displaying the Scheme Stack

When you specify gds-debug-trap as the behaviour for a trap and the Guile program concerned hits that trap, GDS displays the stack and the relevant Scheme source code in Emacs, allowing you to explore the state of the program and then decide what to do next. The same applies if the program calls (on-lazy-handler-dispatch gds-debug-trap) and then throws an exception that passes through lazy-handler-dispatch, except that in this case you can only explore; it isn't possible to continue normal execution after an exception.

The following commands are available in the stack buffer for exploring the state of the program.

u, C-p, <up>
Select the stack frame one up from the currently selected frame (gds-up). GDS displays stack frames with the innermost at the top, so moving “up” means selecting a more “inner” frame.
d, C-n, <down>
Select the stack frame one down from the currently selected frame (gds-down). GDS displays stack frames with the innermost at the top, so moving “down” means selecting a more “outer” frame.
<RET>
Select the stack frame at point (gds-select-stack-frame). This is useful after clicking somewhere in the stack trace with the mouse.

Selecting a frame means that GDS will display the source code corresponding to that frame in the adjacent window, and that subsequent frame-sensitive commands, such as gds-evaluate (see below) and gds-step-over (see Continuing Execution), will refer to that frame.

e
Evaluate a variable or expression in the local environment of the selected stack frame (gds-evaluate). The result is displayed in the echo area.
I
Show summary information about the selected stack frame (gds-frame-info). This includes what type of frame it is, the associated expression, and the frame's source location, if any.
A
For an application frame, display the frame's arguments (gds-frame-args).
S
For an application frame, show the Scheme source code of the procedure being called (gds-proc-source). The source code (where available) is displayed in the echo area.

S (gds-proc-source) is useful when the procedure being called was created by an anonymous (lambda ...) expression. Such procedures appear in the stack trace as <procedure #f (...)>, which doesn't give you much clue as to what will happen next. S will show you the procedure's code, which is usually enough for you to identify it.