3.3 Using Debugger commands

3.3.2 Using restart options

When you enter the Debugger, you are given options to continue, which are called restart options. Restart options often provide very specific ways to proceed that depend on the signaled error. Among the types of restart options are abort restart options, which provide ways to abort the current evaluation, and continue restart options, which provide ways to continue the current evaluation.

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:

You can select any restart option by entering its option number at the Debugger prompt.

This command selects the most recent restart whose name appears on the*default-abort-names* list.

For many error conditions, this command returns you to the level immediately above the current level. Thus, if you are in the third Debugger level,:a returns you to the second Debugger level; if you are in the first Debugger level,:a returns you to the top level of Lisp.

This command aborts the current evaluation and returns you to the Lisp top level. You can use this command any time you are at the Debugger prompt, even if it is not shown in the options list.

This command selects the most recent restart whose name appears on the*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.

If an error condition does not have a continue restart option, this command is not shown in the options list.

To demonstrate these commands, the following simple Debugger interaction defines the functionscale-it that 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:

You could use the:a option 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:c command 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.


The User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker