[Ecls-list] Any way to get stack out of condition?
Anton Vodonosov
avodonosov at yandex.ru
Thu Jan 31 11:32:20 UTC 2013
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
More information about the ecl-devel
mailing list