From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: capturing backtraces Date: Mon, 25 Aug 2014 10:57:48 -0400 Message-ID: References: <874mx1zkhf.fsf@ferrier.me.uk> <871ts5zj35.fsf@ferrier.me.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1408978713 1383 80.91.229.3 (25 Aug 2014 14:58:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Aug 2014 14:58:33 +0000 (UTC) Cc: emacs-devel@gnu.org To: Nic Ferrier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 25 16:58:26 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 1XLvix-0002BZ-3j for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2014 16:58:23 +0200 Original-Received: from localhost ([::1]:48851 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLviw-00042m-Rr for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2014 10:58:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLvid-00042G-9r for emacs-devel@gnu.org; Mon, 25 Aug 2014 10:58:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLviV-000897-Nk for emacs-devel@gnu.org; Mon, 25 Aug 2014 10:58:03 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:50589) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLviV-00088u-Ju for emacs-devel@gnu.org; Mon, 25 Aug 2014 10:57:55 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s7PEvnjp023849; Mon, 25 Aug 2014 10:57:51 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 9609EAE093; Mon, 25 Aug 2014 10:57:48 -0400 (EDT) In-Reply-To: <871ts5zj35.fsf@ferrier.me.uk> (Nic Ferrier's message of "Sun, 24 Aug 2014 22:14:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5044=0 X-NAI-Spam-Version: 2.3.0.9378 : core <5044> : inlines <1204> : streams <1273416> : uri <1806572> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:173823 Archived-At: > (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). Stefan