unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nic Ferrier <nferrier@ferrier.me.uk>
To: emacs-devel@gnu.org
Subject: Re: capturing backtraces
Date: Sun, 24 Aug 2014 22:14:06 +0100	[thread overview]
Message-ID: <871ts5zj35.fsf@ferrier.me.uk> (raw)
In-Reply-To: <874mx1zkhf.fsf@ferrier.me.uk> (Nic Ferrier's message of "Sun, 24 Aug 2014 21:43:56 +0100")

Nic Ferrier <nferrier@ferrier.me.uk> writes:

>   (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.

Aha. Something like this works:

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

 (defvar nic-args nil)

 (flet ((debug (&rest args)
          (setq nic-args args)))
   (condition-case err
       (nic-error)
     ((debug error) "blah")))

It seems a bit odd having to specify the debugger to capture the
backtrace.

I guess I could make a new condition-case like macro that did this
routinely.

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?


Nic



  reply	other threads:[~2014-08-24 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-24 20:43 capturing backtraces Nic Ferrier
2014-08-24 21:14 ` Nic Ferrier [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ts5zj35.fsf@ferrier.me.uk \
    --to=nferrier@ferrier.me.uk \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).