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