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--
Can anyone please help? I am getting really depressed here :(
Thanks,
Eddie
* Zadirion Fay [2010-04-27 16:26+0200] 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).
The simplest way to see all local variables for a frame is to press RETURN (or t) on that line. After that your example that would look like:
Backtrace: 0: (sample-function 3 4) Locals: x = 3 y = 4 1: (sb-int:simple-eval-in-lexenv (sample-function 3 4) #<NULL-LEXENV>)
The compiler could also optimize things away since x and y aren't used after the call to ERROR. In that case you can play with different optimize settings or simply write the error message so that it includes the info you want to know:
(error "The sum of x (~d) and y (~d) must be greater than 15" x y)
Helmut
Zadirion Fay wrote:
(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.
I'd guess the compiler has optimized out that information. Try either
(defun sample-function (x y) (declare (optimize (debug 3))) (if (> (+ x y) 15) (+ x y) (error "The sum of x and y must be greater than 15")))
or (declaim (optimize (debug 3))) (defun sample-function (x y) (if (> (+ x y) 15) (+ x y) (error "The sum of x and y must be greater than 15")))
The declaration only enables debugging for sample-function; the declamation affects everything following it.
- Daniel
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--
Can anyone please help? I am getting really depressed here :(
Thanks,
Eddie _______________________________________________ slime-devel site list slime-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/slime-devel
Zadirion Fay zadirion@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).