Next: , Previous: Display Backtrace, Up: Interactive Debugger


3.4.3.2 Frame Selection

A call stack consists of a sequence of stack frames, with each frame describing one level of the nested evaluations and applications that the program was executing when it hit a breakpoint or an error. Frames are numbered such that frame 0 is the outermost — i.e. the operation on the call stack that began least recently — and frame N-1 the innermost (where N is the total number of frames on the stack).

When you enter the debugger, the innermost frame is selected, which means that the commands for getting information about the “current” frame, or for evaluating expressions in the context of the current frame, will do so by default with respect to the innermost frame. To select a different frame, so that these operations will apply to it instead, use the up, down and frame commands like this:

     debug> up
     Frame 1 at standard input:36:14
             [* 4 ...
     debug> frame 0
     Frame 0 at standard input:36:1
             [make-string ...
     debug> down
     Frame 1 at standard input:36:14
             [* 4 ...
— Debugger Command: up [n]

Move n frames up the stack. For positive n, this advances toward the outermost frame, to higher frame numbers, to frames that have existed longer. n defaults to one.

— Debugger Command: down [n]

Move n frames down the stack. For positive n, this advances toward the innermost frame, to lower frame numbers, to frames that were created more recently. n defaults to one.

— Debugger Command: frame [n]

Select and print a stack frame. With no argument, print the selected stack frame. (See also “info frame”.) An argument specifies the frame to select; it must be a stack-frame number.