[slime-devel] Debugging variables

Stas Boukarev stassats at gmail.com
Tue Apr 27 15:07:25 UTC 2010


Zadirion Fay <zadirion at gmail.com> writes:

> Hello,
>
> I am new to slime and Lisp in general. I did try searching google before
> posting this but I can not seem to find any answer to this, so here goes:
>
> (defun sample-function (x y)
>     (if (> (+ x y) 15)
>         (+ x y)
>         (error "The sum of x and y must be greater than 15")))
>
> (sample-function 3 4)
>
>
> Given the above code, I can not seem to be able to display the value of x or y
> for that matter once the debugger kicks in on the line with the error.
> Once inside the debugger, I tried pressing 'i' for inspect and entered x.
> Debugger replied with "unbound variable x blabla". Pressed 'e' for eval and
> wrote (sb-debug:var x) with
> same result (using sbcl here).
>
> Here is exactly what the debugger posts:
>
> The sum of x and y must be greater than 15
>    [Condition of type SIMPLE-ERROR]
>
> Restarts:
>  0: [ABORT] Abort compilation.
>  1: [ABORT] Return to SLIME's top level.
>  2: [CLOSE-CONNECTION] Close SLIME connection
>  3: [ABORT] Exit debugger, returning to top level.
>
> Backtrace:
>   0: (SAMPLE-FUNCTION 3 4)
>   1: (SB-FASL::LOAD-FASL-GROUP #<SB-SYS:FD-STREAM for "file C:\\Users\\Eddie\\
> AppData\\Local\\Temp\\16.fasl" {24165B59}>)
>   2: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK))
>   3: (SB-FASL::LOAD-AS-FASL #<SB-SYS:FD-STREAM for "file C:\\Users\\Eddie\\
> AppData\\Local\\Temp\\16.fasl" {24165B59}> NIL #<unavailable argument>)
>   4: ((FLET SB-FASL::LOAD-STREAM) #<SB-SYS:FD-STREAM for "file C:\\Users\\Eddie
> \\AppData\\Local\\Temp\\16.fasl" {24165B59}> T)
>   5: (LOAD #P"C:\\Users\\Eddie\\AppData\\Local\\Temp\\16.fasl")[:EXTERNAL]
>   6: ((FLET SWANK-BACKEND:SWANK-COMPILE-STRING) "(sample-function 3 4)" :BUFFER
> "new.lisp" :POSITION 133 :FILENAME NIL :POLICY NIL)
>   7: ((LAMBDA ()))
>   8: ((LAMBDA ()))
>  --more--
You need to press return on the desired frame, 0: (SAMPLE-FUNCTION 3 4),
in that case. With `e', you have to enter only `x'. And to get generally
better debugging information, you may compile your function with higher
debugging settings, C-u C-c C-c does that autamtically on SBCL (C-u C-c
C-k works also).

-- 
With Best Regards, Stas.




More information about the slime-devel mailing list