2011-06-25 11:48:05 |
Paul Khuong |
description |
(declaim (optimize (debug 3) (safety 3) (speed 0)))
(defun 3n+1/2 (n)
(if (= 1 n)
nil
(if (evenp n)
(floor n 2)
(1+ (* 3 n)))))
(3n+1/2 nil)
gives a stack dump like this:
debugger invoked on a SIMPLE-TYPE-ERROR in thread #<THREAD "initial thread" RUNNING {1002BCACD1}>: Argument X is not a NUMBER: NIL
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-KERNEL:TWO-ARG-= NIL 1)
0] backtrace
0: (SB-KERNEL:TWO-ARG-= NIL 1)
1: ("no debug information for frame")
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (|3N+1/2| NIL) #<NULL-LEXENV>)
3: (SB-EXT:INTERACTIVE-EVAL (|3N+1/2| NIL) :EVAL NIL)
4: (SB-IMPL::REPL-FUN NIL)
5: ((LAMBDA NIL))
6: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA NIL) {10034BA559}>)
7: (SB-IMPL::TOPLEVEL-REPL NIL)
8: (SB-IMPL::TOPLEVEL-INIT)
9: ((LABELS SB-IMPL::RESTART-LISP))
Now the problem is that the function where "=" is called (3n+1/2) is not listed - all that I see is
1: ("no debug information for frame")
In this case it's not a real problem; but in another case, where the function calling "=" was a LABELS generated by a macro there was no easy way to see what the problem is.
Perhaps that's related to https://bugs.launchpad.net/sbcl/+bug/309079 - I have x86_64 SBCL 1.0.49.0.debian.
pjb on #lisp said "I guess the reason why 3n+1/2 is not listed is that two-arg-= is open-coded, and it shadows your 3n+1/2 frame." I cannot claim to fully understand the implications, but I _do_ assert that with (debug 3) the whole stack trace should be visible - even more as eg. TCO gets turned off for such things, too.
Thanks for all hints. |
(declaim (optimize (debug 3) (safety 3) (speed 0)))
(defun 3n+1/2 (n)
(if (= 1 n)
nil
(if (evenp n)
(floor n 2)
(1+ (* 3 n)))))
(3n+1/2 nil)
gives a stack dump like this:
debugger invoked on a SIMPLE-TYPE-ERROR in thread #<THREAD "initial thread" RUNNING {1002BCACD1}>: Argument X is not a NUMBER: NIL
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-KERNEL:TWO-ARG-= NIL 1)
0] backtrace
0: (SB-KERNEL:TWO-ARG-= NIL 1)
1: ("no debug information for frame")
2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (|3N+1/2| NIL) #<NULL-LEXENV>)
3: (SB-EXT:INTERACTIVE-EVAL (|3N+1/2| NIL) :EVAL NIL)
4: (SB-IMPL::REPL-FUN NIL)
5: ((LAMBDA NIL))
6: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA NIL) {10034BA559}>)
7: (SB-IMPL::TOPLEVEL-REPL NIL)
8: (SB-IMPL::TOPLEVEL-INIT)
9: ((LABELS SB-IMPL::RESTART-LISP))
Now the problem is that the function where "=" is called (3n+1/2) is not listed - all that I see is
1: ("no debug information for frame") |
|