I am currently using LispWorks, and I would like to setup the REPL so that I can exit the debugger simply by typing the number corresponding to (abort) Return to top loop level 0
, the same way one can do using SBCL.
Normally, using LispWorks one needs to type :c + [abort option number]
.
See a trivial example, using LispWorks:
CL-USER 1 > a
Error: The variable A is unbound.
1 (continue) Try evaluating A again.
2 Return the value of :A instead.
3 Specify a value to use this time instead of evaluating A.
4 Specify a value to set A to.
5 (abort) Return to top loop level 0.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
CL-USER 2 : 1 > :c 5
CL-USER 3 >
While using SBCL, just the number will suffice:
* a
debugger invoked on a UNBOUND-VARIABLE in thread
#<THREAD "main thread" RUNNING {10012E0613}>:
The variable A is unbound.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Retry using A.
1: [USE-VALUE ] Use specified value.
2: [STORE-VALUE] Set specified value and use it.
3: [ABORT ] Exit debugger, returning to top level.
(SB-INT:SIMPLE-EVAL-IN-LEXENV A #<NULL-LEXENV>)
0] 3
*
The REPL debugger commands documentation does not seem to list such possibility.
If possible, how can one exit LispWorks REPL debugger, returning to top level typing just a number, like with SBCL?
Basically you can't. It's also more consistent:
* a
debugger invoked on a UNBOUND-VARIABLE in thread
#<THREAD "main thread" RUNNING {10005004F3}>:
The variable A is unbound.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE ] Retry using A.
1: [USE-VALUE ] Use specified value.
2: [STORE-VALUE] Set specified value and use it.
3: [ABORT ] Exit debugger, returning to top level.
(SB-INT:SIMPLE-EVAL-IN-LEXENV A #<NULL-LEXENV>)
0] 4
4
0] 3
*
In the above example with SBCL, the numbers 0...3 choose that debugger option and all other numbers evaluate... that's a bit strange.
LispWorks: simple abort in the debugger
In LispWorks if you would want to use the abort
restart, use :a
:
CL-USER 1 > a
Error: The variable A is unbound.
1 (continue) Try evaluating A again.
2 Return the value of :A instead.
3 Specify a value to use this time instead of evaluating A.
4 Specify a value to set A to.
5 (abort) Return to level 0.
6 Return to top-level loop.
7 Return from multiprocessing.
Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.
CL-USER 2 : 1 > :a
CL-USER 3 >
There is also the meta-shift-a keyboard command in the LispWorks environment to abort in the debugger. Additionally the restarts are available in the menu and in the right-click context menu. Also one can use the abort icon in the icon bar of the listener/debugger/...
Advantage: you don't have to remember the number of the restart, since that may be different from error to error.