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: Mon, 25 Aug 2014 17:27:43 +0100 Message-ID: <87vbpgy1og.fsf@ferrier.me.uk> 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 1408984104 8322 80.91.229.3 (25 Aug 2014 16:28:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Aug 2014 16:28:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 25 18:28:17 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 1XLx7w-0005g2-Rm for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2014 18:28:16 +0200 Original-Received: from localhost ([::1]:49297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLx7w-0004fX-BI for ged-emacs-devel@m.gmane.org; Mon, 25 Aug 2014 12:28:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37016) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLx7c-0004fQ-Kq for emacs-devel@gnu.org; Mon, 25 Aug 2014 12:28:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XLx7W-0005Ih-NC for emacs-devel@gnu.org; Mon, 25 Aug 2014 12:27:56 -0400 Original-Received: from static.17.66.46.78.clients.your-server.de ([78.46.66.17]:40678 helo=po1.ferrier.me.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XLx7W-0005I8-Go for emacs-devel@gnu.org; Mon, 25 Aug 2014 12:27:50 -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 001A7AC014A; Mon, 25 Aug 2014 18:41:19 +0200 (CEST) Original-Received: from nicferrier-XPS13-9333 (localhost [127.0.0.1]) by nicferrier-dell-xps (Postfix) with ESMTPS id 0E94F60A01; Mon, 25 Aug 2014 17:27:44 +0100 (BST) In-Reply-To: (Stefan Monnier's message of "Mon, 25 Aug 2014 10:57:48 -0400") 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:173825 Archived-At: Stefan Monnier writes: > > (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). We could just have a variable to decide whether the signal should do that or not. A bit like binding the debugger variable, but not quite so extreme. I will probably setq the debugger variable for now, to achieve what I want. But I think I still have to arrange for the condition-cases to have the debug symbol, which means I have to write the code in a particular way just for this reason. Nic