3.3 Using Debugger commands
The examples in this chapter show the standard restart options, which are to return to a previous Debugger level or the Lisp top level and to repeat the current evaluation.
The Common Lisp Condition System provides a way to write additional restart options. For more information, see Common Lisp: The Language, 2nd edition, by Guy L. Steele, Jr. (hereafter referred to as CLtL2).
The following variables contain the names of the abort and continue restart options used by the Debugger. These variables are extensions to Common Lisp:
*default-abort-names* *default-continue-names*You can select a restart option by typing one of the following commands:
:areturns you to the second Debugger level; if you are in the first Debugger level,
:areturns you to the top level of Lisp.
*default-continue-names*list. The restart must be more recent than the most recent abort restart. A continue restart option provides a way to continue the evaluation.
scale-itthat contains a reference to the unbound variable
*scaling-factor*. When the function is called, an error is signaled and the Debugger is entered:
> (defun scale-it (x) (declare (special *scaling-factor*)) (* x *scaling-factor*)) SCALE-IT > (scale-it 3) >>Error: The symbol *SCALING-FACTOR* has no global value. +++ Conditional FALSE: parallel SYMBOL-VALUE: Required arg 0 (S): *SCALING-FACTOR* :C 0: Try evaluating *SCALING-FACTOR* again :A 1: Abort to Lisp Top Level ->The Debugger display provides the following information:
*scaling-factor*has no global binding.
symbol-valuewas the function being executed when the error was signaled. The function
symbol-valuelooks up the value of a symbol; it signals an error if the symbol has no assigned value.
symbol-valuehas one required argument, named
s, which has been given the value
*scaling-factor*again, or to abort the evaluation by returning to the top level.
:aoption to return to the top level of Lisp and continue entering expressions as though no error had occurred. It might be more useful, however, to correct the error in the Debugger and use the
:ccommand to complete the evaluation. Remember that within the Debugger you can enter expressions that modify the incomplete function. In the following interaction, the variable
*scaling-factor*is bound as a global variable and the initial evaluation is completed:
>>Error: The symbol *SCALING-FACTOR* has no global value. SYMBOL-VALUE: Required arg 0 (S): *SCALING-FACTOR* :C 0: Try evaluating *SCALING-FACTOR* again :A 1: Abort to Lisp Top Level -> (setq *scaling-factor* 5) 5 -> :c Try evaluating *SCALING-FACTOR* again 15 >Note that the variable
*scaling-factor*is now globally bound.
Generated with Harlequin WebMaker