unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* capturing backtraces
@ 2014-08-24 20:43 Nic Ferrier
  2014-08-24 21:14 ` Nic Ferrier
  0 siblings, 1 reply; 6+ messages in thread
From: Nic Ferrier @ 2014-08-24 20:43 UTC (permalink / raw)
  To: emacs-devel

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
     (thing-that-causes-errors)
    (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
macroexp--backtrace
(http://lists.gnu.org/archive/html/emacs-devel/2014-05/msg00268.html)
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
     (nic-error)
   (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.


Anyone?


Nic



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-08-25 20:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-24 20:43 capturing backtraces Nic Ferrier
2014-08-24 21:14 ` Nic Ferrier
2014-08-25  2:43   ` Samuel Bronson
2014-08-25 14:57   ` Stefan Monnier
2014-08-25 16:27     ` Nic Ferrier
2014-08-25 20:13       ` Nic Ferrier

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).