[Top][All Lists]

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

capturing backtraces

From: Nic Ferrier
Subject: capturing backtraces
Date: Sun, 24 Aug 2014 21:43:56 +0100

I want to capture the backtrace that was current at the time of an error
into a list, string or buffer.

Something like:

  (condition-case err
    (error (setq saved-backtrace 
              (way-to-get-backtrace-from-error err))))

Where the function way-to-get-backtrace-from-error represents a function
that can get the backtrace from an error.

Anyone have a clue how I can do that?

I asked this question before and Stefan referred me to
which uses backtrace-frame. That function doesn't seem to be able to get
the backtrace from the point of the error though:

 (defun nic-error ()
   (let ((x 1))
     (error "MEH")))

 (condition-case err
   (error (backtrace-frame 1)))

 => (nil condition-case err (nic-error) (error (backtrace-frame 1)))

that's not what I want at all, as you can see it grabs the current
backtrace of the currently executing stack.

We must be able to do this though because the debugger does it to
display the backtrace that happened to cause an error when we have
debug-on-error turned on.



reply via email to

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