[Ecls-list] Any way to get stack out of condition?

Peter Enerccio enerccio at gmail.com
Thu Jan 31 15:11:12 UTC 2013


By the way, anton, your guess is right.

> ((lambda () (si::ihs-fun 1)))

#<bytecompiled-function SI:BYTECODES>

directly from ecl repl..


2013/1/31 Peter Enerccio <enerccio at gmail.com>

> I managed to grab c stack (on linux anyways) which is nice, but not that
> very revealing for any bytecoded functions...
>
> Unhandled error detected:
> something went hairy
> Backtrace:
>
> C stack:
> /media/home/home/enerccio/
> projects/gaia/gaia/Debug/gaia(c_stack+0x62) [0x4024ae]
> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x2a26)
> [0x7fe16cfc3a26]
> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x26d7)
> [0x7fe16cfc36d7]
> /usr/lib/libecl.so.12.12(+0x12eb99) [0x7fe170954b99]
> /usr/lib/libecl.so.12.12(+0x12ed88) [0x7fe170954d88]
> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
> /usr/lib/libecl.so.12.12(cl_error+0xd6) [0x7fe1709b0406]
> /usr/lib/libecl.so.12.12(ecl_interpret+0x1cad) [0x7fe1709921bd]
> /usr/lib/libecl.so.12.12(ecl_interpret+0x1ece) [0x7fe1709923de]
> /usr/lib/libecl.so.12.12(+0x17118f) [0x7fe17099718f]
> /usr/lib/libecl.so.12.12(si_eval_with_env+0x2eb) [0x7fe170998d3b]
> /usr/lib/libecl.so.12.12(si_load_source+0x191) [0x7fe1709e7e41]
> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
> /usr/lib/libecl.so.12.12(cl_load+0x46d) [0x7fe1709e86bd]
> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x2ced)
> [0x7fe16cfc3ced]
> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x30ee)
> [0x7fe16cfc40ee]
> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(init_fas_CODE+0xc35)
> [0x7fe16cfc5ca5]
> /usr/lib/libecl.so.12.12(ecl_init_module+0x409) [0x7fe1709acbb9]
> /usr/lib/libecl.so.12.12(si_load_binary+0x9a) [0x7fe1709e7b7a]
> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
> /usr/lib/libecl.so.12.12(cl_load+0x46d) [0x7fe1709e86bd]
> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia(init_common_lisp_subsystem+0xa0)
> [0x40243a]
> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia(main+0x2a)
> [0x40226e]
> /usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7fe16fabd725]
> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia() [0x4019f9]
>
>
> 2013/1/31 Peter Enerccio <enerccio at gmail.com>
>
>> I managed to grab c stack (on linux anyways) which is nice, but not that
>> very revealing for any bytecoded functions...
>>
>> Unhandled error detected:
>> something went hairy
>> Backtrace:
>>
>> C stack:
>> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia(c_stack+0x62)
>> [0x4024ae]
>> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x2a26)
>> [0x7fe16cfc3a26]
>> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x26d7)
>> [0x7fe16cfc36d7]
>> /usr/lib/libecl.so.12.12(+0x12eb99) [0x7fe170954b99]
>> /usr/lib/libecl.so.12.12(+0x12ed88) [0x7fe170954d88]
>> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
>> /usr/lib/libecl.so.12.12(cl_error+0xd6) [0x7fe1709b0406]
>> /usr/lib/libecl.so.12.12(ecl_interpret+0x1cad) [0x7fe1709921bd]
>> /usr/lib/libecl.so.12.12(ecl_interpret+0x1ece) [0x7fe1709923de]
>> /usr/lib/libecl.so.12.12(+0x17118f) [0x7fe17099718f]
>> /usr/lib/libecl.so.12.12(si_eval_with_env+0x2eb) [0x7fe170998d3b]
>> /usr/lib/libecl.so.12.12(si_load_source+0x191) [0x7fe1709e7e41]
>> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
>> /usr/lib/libecl.so.12.12(cl_load+0x46d) [0x7fe1709e86bd]
>> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x2ced)
>> [0x7fe16cfc3ced]
>> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(+0x30ee)
>> [0x7fe16cfc40ee]
>> /media/home/home/enerccio/projects/gaia/gaia/postinit.fas(init_fas_CODE+0xc35)
>> [0x7fe16cfc5ca5]
>> /usr/lib/libecl.so.12.12(ecl_init_module+0x409) [0x7fe1709acbb9]
>> /usr/lib/libecl.so.12.12(si_load_binary+0x9a) [0x7fe1709e7b7a]
>> /usr/lib/libecl.so.12.12(cl_funcall+0x78) [0x7fe17098f9e8]
>> /usr/lib/libecl.so.12.12(cl_load+0x46d) [0x7fe1709e86bd]
>> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia(init_common_lisp_subsystem+0xa0)
>> [0x40243a]
>> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia(main+0x2a)
>> [0x40226e]
>> /usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7fe16fabd725]
>> /media/home/home/enerccio/projects/gaia/gaia/Debug/gaia() [0x4019f9]
>>
>>
>>
>> 2013/1/31 Anton Vodonosov <avodonosov at yandex.ru>
>>
>>> Another guess (sorry if I am mistaken).
>>>
>>> Do you run this code from the main REPL thread or from another thread?
>>>
>>> I remember I debugged hunchentoot on ECL and wanted stack trace
>>> of error happened during request handling (hunchentoot runs
>>> request handlers in separate threads).
>>>
>>> As you did, I looked at the ECL backtrace functions used in SLIME
>>> and tried to use them. Stack trace was empty.
>>>
>>> I looked at their source code and have *impression* that
>>> stack trace is only maintained for the REPL thread.
>>>
>>> Juan Jose must know better how stacktraces are implemented.
>>> But if you run from another thread, try from REPL. If you
>>> run from REPL and still doesn't have stacktrace, then
>>> my guess above does not apply.
>>>
>>> Best regards,
>>> - Anton
>>>
>>> 30.01.2013, 20:07, "Peter Enerccio" <enerccio at gmail.com>:
>>> > Well, I am trying to get with handler-bind, however, it still prints
>>> nothing at all (for the backtrace, I mean)
>>> >
>>> > (defun handle-any-error-log (e)
>>> >   (print "x") ; checking that we are indeed in the handler
>>> >   (with-open-file (eout "errors.txt"
>>> >             :direction :output)
>>> >     (format eout "Unhandled error detected: ~%")
>>> >     (format eout "~A~%" e)
>>> >     (format eout "Backtrace: ~%")
>>> >     (loop for x from (si::ihs-top)
>>> >        to 0 do
>>> >      (format eout "~A~%" (si::ihs-fun x)))
>>> >     (format eout "~%")))
>>> >
>>> > (eval-when (:load-toplevel :execute)
>>> >   (handler-bind
>>> >       ((error #'handle-any-error-log))
>>> >     (post-initialization)))
>>> >
>>> > Output:
>>> >
>>> > enerccio at G73Jh-Arch:~/projects/gaia/gaia$ cat errors.txt
>>> > Unhandled error detected:
>>> > LOAD: Could not load file
>>> #P"/media/home/home/enerccio/projects/gaia/gaia/plugins/crap.fas" (Error:
>>> "/media/home/home/enerccio/projects/gaia/gaia/plugins/crap.fas: file too
>>> short")
>>> > Backtrace:
>>> > NIL
>>> >
>>> > 2013/1/30 Anton Vodonosov <avodonosov at yandex.ru>
>>> >> In CL you usually can't get stack trace "out of condition".
>>> >>
>>> >> Usually you can get the current stack trace. I.e. before stack is
>>> unwound.
>>> >> I.e. catching error handler-bind you can get stack trace, because you
>>> are still
>>> >> inside the stack, but for example with handler-case you are invoked
>>> after
>>> >> the stack is unwound.
>>> >>
>>> >> PS. also check out trivial-backtrace if you want be portable library,
>>> although
>>> >> I don't know if it supports ECL.
>>> >>
>>> >> 30.01.2013, 19:49, "Peter Enerccio" <enerccio at gmail.com>:
>>> >>> I tried looking it up there, however it uses
>>> si::ihs-top/si::ihs-fun, which at the condition handlers are for some
>>> reason 0 so there is nothing to do at that point.
>>> >>>
>>> >>> 2013/1/30 Stas Boukarev <stassats at gmail.com>
>>> >>>> Peter Enerccio <enerccio at gmail.com> writes:
>>> >>>>
>>> >>>>> Hello, I was wondering if it is possible to get the stack of thrown
>>> >>>>> condition.
>>> >>>>> I dont think there is ansi way of doing that, however, I can see
>>> stack
>>> >>>>> generated by conditions thrown in slime with ecl, so there must be
>>> a way to
>>> >>>>> do it.
>>> >>>> You can look at swank-ecl.lisp to see how slime does it.
>>> >>>>
>>> >>>> --
>>> >>>> With best regards, Stas.
>>> >>>
>>> >>> --
>>> >>> Bc. Peter Vaňušanik
>>> >>> http://www.bishojo.tk
>>> >>
>>> >>> ,
>>> >>>
>>> ------------------------------------------------------------------------------
>>> >>> Everyone hates slow websites. So do we.
>>> >>> Make your web apps faster with AppDynamics
>>> >>> Download AppDynamics Lite for free today:
>>> >>> http://p.sf.net/sfu/appdyn_d2d_jan
>>> >>> ,
>>> >>> _______________________________________________
>>> >>> Ecls-list mailing list
>>> >>> Ecls-list at lists.sourceforge.net
>>> >>> https://lists.sourceforge.net/lists/listinfo/ecls-list
>>> >
>>> > --
>>> > Bc. Peter Vaňušanik
>>> > http://www.bishojo.tk
>>> > ,
>>> >
>>> ------------------------------------------------------------------------------
>>> > Everyone hates slow websites. So do we.
>>> > Make your web apps faster with AppDynamics
>>> > Download AppDynamics Lite for free today:
>>> > http://p.sf.net/sfu/appdyn_d2d_jan
>>> > ,
>>> > _______________________________________________
>>> > Ecls-list mailing list
>>> > Ecls-list at lists.sourceforge.net
>>> > https://lists.sourceforge.net/lists/listinfo/ecls-list
>>>
>>
>>
>>
>> --
>> Bc. Peter Vaňušanik
>> http://www.bishojo.tk
>>
>
>
>
> --
> Bc. Peter Vaňušanik
> http://www.bishojo.tk
>



-- 
Bc. Peter Vaňušanik
http://www.bishojo.tk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130131/68b1a9a2/attachment.html>


More information about the ecl-devel mailing list