emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: capturing backtraces


From: Nic Ferrier
Subject: Re: capturing backtraces
Date: Mon, 25 Aug 2014 17:27:43 +0100

Stefan Monnier <address@hidden> writes:

>  > (flet ((debug (&rest args)
>  >          (setq nic-args args)))
>
> Better bind the `debugger' variable.
>
>> Wouldn't it be better to just grab the backtrace whenever an error
>> occurs and put it in a global or push it on to a global list?
>
> Depends what you mean by better: the normal representation of the
> backtrace is transient (embedded in the C stack), so that would require
> converting it to an Elisp list upon every call to Fsignal.
>
> IOW, you'd have to pay for it all the time, even tho it's very rarely
> used (as a percentage of the number of times Fsignal is called).
>
> But we could probably arrange for something less hackish than rebinding
> `debug'.  Maybe a new debugger-extra-data-function which would be called
> by Fsignal and whose return value would be added data to the condition
> that's being signaled (so you'd receive it in the `err' variable of your
> condition-case).

We could just have a variable to decide whether the signal should do
that or not.

A bit like binding the debugger variable, but not quite so extreme.

I will probably setq the debugger variable for now, to achieve what I
want.

But I think I still have to arrange for the condition-cases to have the
debug symbol, which means I have to write the code in a particular way
just for this reason.


Nic



reply via email to

[Prev in Thread] Current Thread [Next in Thread]