Google has failed me again. If I'm not in the wonderful world of slime, and just am using the clisp interpreter, how do I do a stack trace? It telling me I'm giving a bad parameter to "+" with no line number isn't very handy.
Siggy
Stack trace in clisp
Re: Stack trace in clisp
Line numbers aren't generally used in lisp... They are less useful with macros, forms crossing multiple lines, etc.
As for debugging, please see the Clisp documentation, in particular the section on REPL commands.
The following example session may help.
As for debugging, please see the Clisp documentation, in particular the section on REPL commands.
The following example session may help.
Code: Select all
[1]> (+ 1 'a)
*** - +: A is not a number
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead.
ABORT :R2 Abort main loop
Break 1 [2]> help
Commands may be abbreviated as shown in the second column.
COMMAND ABBR DESCRIPTION
Help :h, ? print this command list
Error :e print the last error message
Inspect :i inspect the last error
Abort :a abort to the next recent input loop
Unwind :uw abort to the next recent input loop
Reset :re toggle *PACKAGE* and *READTABLE* between the
local bindings and the sane values
Quit :q quit to the top-level input loop
Where :w inspect this frame
Up :u go up one frame, inspect it
Top :t go to top frame, inspect it
Down :d go down one frame, inspect it
Bottom :b go to bottom (most recent) frame, inspect it
Mode mode :m set stack mode for Backtrace: 1=all the stack elements
2=all the frames 3=only lexical frames
4=only EVAL and APPLY frames (default) 5=only APPLY frames
Frame-limit n :fl set the frame-limit for Backtrace. This many frames
will be printed in a backtrace at most.
Backtrace [mode [limit]] :bt inspect the stack
Break+ :br+ set breakpoint in EVAL frame
Break- :br- disable breakpoint in EVAL frame
Redo :rd re-evaluate form in EVAL frame
Return value :rt leave EVAL frame, prescribing the return values
The following restarts are available:
USE-VALUE :R1 Input a value to be used instead.
ABORT :R2 Abort main loop
Break 1 [2]> :bt
<1/149> #<SYSTEM-FUNCTION SHOW-STACK> 3
<2/142> #<COMPILED-FUNCTION SYSTEM::PRINT-BACKTRACE>
<3/136> #<COMPILED-FUNCTION SYSTEM::DEBUG-BACKTRACE>
<4/127> #<SYSTEM-FUNCTION SYSTEM::READ-EVAL-PRINT> 2
<5/124> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2-3>
<6/120> #<SYSTEM-FUNCTION SYSTEM::SAME-ENV-AS> 2
<7/106> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP-2>
<8/104> #<SYSTEM-FUNCTION SYSTEM::DRIVER>
<9/64> #<COMPILED-FUNCTION SYSTEM::BREAK-LOOP>
<10/61> #<SYSTEM-FUNCTION INVOKE-DEBUGGER> 1
<11/51> #<SYSTEM-FUNCTION ERROR>
<12/38> #<COMPILED-FUNCTION SYSTEM::CHECK-VALUE>
<13/36> #<SYSTEM-FUNCTION +> 2
[34] EVAL frame for form (+ 1 'A)
Printed 13 frames
Break 1 [2]> :rt 3
3
[3]>
Re: Stack trace in clisp
Many thanks. I found the docs, but Google had taken me to how to do a straight-up trace, no a back trace, on the next pagenuntius wrote:As for debugging, please see the Clisp documentation, in particular the section on REPL commands.

Oh yeah. You can type "help" and sometimes actually find something useful.... Lol. I'm so used to such things being useless that I forget to try.
Siggy