From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nic Ferrier Newsgroups: gmane.emacs.devel Subject: Re: capturing backtraces Date: Sun, 24 Aug 2014 22:14:06 +0100 Message-ID: <871ts5zj35.fsf@ferrier.me.uk> References: <874mx1zkhf.fsf@ferrier.me.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1408914882 9865 80.91.229.3 (24 Aug 2014 21:14:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 24 Aug 2014 21:14:42 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Aug 24 23:14:35 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XLf7S-0003U6-M6 for ged-emacs-devel@m.gmane.org; Sun, 24 Aug 2014 23:14:34 +0200 Original-Received: from localhost ([::1]:45317 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLf7S-0004FK-6E for ged-emacs-devel@m.gmane.org; Sun, 24 Aug 2014 17:14:34 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51381) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLf7B-0004FB-G8 for emacs-devel@gnu.org; Sun, 24 Aug 2014 17:14:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLf75-0005w2-8e for emacs-devel@gnu.org; Sun, 24 Aug 2014 17:14:17 -0400 Original-Received: from static.17.66.46.78.clients.your-server.de ([78.46.66.17]:40347 helo=po1.ferrier.me.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLf75-0005vm-3N for emacs-devel@gnu.org; Sun, 24 Aug 2014 17:14:11 -0400 Original-Received: from nicferrier-dell-xps (140.35.155.90.in-addr.arpa [90.155.35.140]) by po1.ferrier.me.uk (Postfix) with ESMTPA id 7CDABAC00C3; Sun, 24 Aug 2014 23:27:38 +0200 (CEST) Original-Received: from nicferrier-XPS13-9333 (localhost [127.0.0.1]) by nicferrier-dell-xps (Postfix) with ESMTPS id 3FDE760A01; Sun, 24 Aug 2014 22:14:06 +0100 (BST) In-Reply-To: <874mx1zkhf.fsf@ferrier.me.uk> (Nic Ferrier's message of "Sun, 24 Aug 2014 21:43:56 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 78.46.66.17 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:173816 Archived-At: Nic Ferrier 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