[Ecls-list] function names in backtrace
Anton Vodonosov
avodonosov at yandex.ru
Mon Dec 8 11:19:07 UTC 2008
08.12.08, 12:33, "Juan Jose Garcia-Ripoll" <juanjose.garciaripoll at googlemail.com>:
> On Mon, Dec 8, 2008 at 2:36 AM, Anton Vodonosov <avodonosov at yandex.ru> wrote:
> > Is it possible to see function names in backtrace?
> > Instead of
> > Backtrace: LAMBDA > lambda > si:bytecodes > si:bytecodes > si:bytecodes
> Those lambda forms do not have names because the user did not give it
> to them. They are anonymous functions, of the form #'(lambda (..) ...)
> and that is why the debugger does not print names. Or is it not the
> case? Similarly the interpreter forms, BYTECODES, which are plain lisp
> statements, also do not have names.
> Juanjo
The above backtrace is from the error in flexi-streams we are discussing
in another thread. Therefore some non-anonymous functions are called.
Simpler self-contained example:
(defun f1 () (error "test error"))
(defun f2 () (f1))
(defun f3() (f2))
> (f3)
test error
Broken at SI:BYTECODES.No restarts available.
Broken at F1.
>> :b
Backtrace: F1 > f2 > f3 > si:bytecodes > si:bytecodes > si:bytecodes
>> :pop
Top level.
Functions are present in backtrace. Now compile them.
(compile 'f1)
(compile 'f2)
(compile 'f3)
> > (f3)
test error
Broken at SI:BYTECODES.No restarts available.
Broken at SI:BYTECODES.
>> :b
Backtrace: SI:BYTECODES > si:bytecodes > si:bytecodes
>>>> :pop
Top level.
>
Function disappeared. Is it because of some inlining during compilation?
If yes, it is some very cool total inlining, that is able to inline
all the flexi-streams : )
If this is inlining, it is also interesing that it handles
function redefinition:
(defun f1 () (format t "hello~%"))
> (f3)
hello
NIL
>
I.e. function are still called via some indirection that allows
new definition of F1 to be called from previously compiled code.
;; back to compiled error version
(defun f1 () (error "test error"))
(compile 'f1)
;; but now F2 is byte-compiled
(defun f2 () (f1))
> (f3)
test error
Broken at SI:BYTECODES.No restarts available.
Broken at F2.
>> :b
Backtrace: F2 > si:bytecodes > si:bytecodes > si:bytecodes
>>
Here byte-compiled F2 is visible in the stack.
It looks like compiled functions just loose their names
and other info allowing them to appear in backtrace?
Is it correct?
> #'f2
#<bytecompiled-function #<bytecompiled-function F2>>
> #'f1
#<compiled-function 00c00690>
>
What would be the best strategy to debug errors?
Keep all the libraries byte-compiled? Is there any global
compiler switch or some trick to preserve move debug info
on everything during asdf-compilation?
Best regards,
- Anton
More information about the ecl-devel
mailing list