3.3.3 Examining and moving through the stack

3.3.3.1 Moving through the stack

You can move through the stack by selecting a new stack frame to become the current stack frame. You move up the stack by moving toward the most recently called function; you move down the stack by moving toward the earliest called function.

The Debugger provides the following commands to move through the stack:

To demonstrate moving through the stack, the following example defines a function namedsquare:

> (defun square (x)
    (* x x))
SQUARE

If you call the function with a symbol passed as the function argument, you enter the Debugger:

> (square 'a)
>>Error: The value of RESULT, A, should be a NUMBER
*:
   Rest arg 0 (RESTARG): (A A)
:C  0: Use a new value
:A  1: Abort to Lisp Top Level
-> 

You can move down one stack frame, toward the previously called function, and display that frame by using the:n command:

-> :n
SQUARE:
Original code: (NAMED-LAMBDA SQUARE (X) (BLOCK SQUARE (* X X)))
   Required arg 0 (X): A
-> 

You can move up one stack frame, toward the most recently called function, by using the:p command:

-> :p
*:
   Rest arg 0 (RESTARG): (A A)

You can move to the top of the stack by using the:< command. The current frame contains the function that invokes the Debugger:

-> :<
INVOKE-DEBUGGER:
   Required arg 0 (CONDITION): #<Condition TYPE-ERROR 79792B>
-> 


The User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker