From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Need to get Lisp backtrace when error is in C code Date: Tue, 03 Oct 2017 13:50:27 -0400 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507053066 8536 195.159.176.226 (3 Oct 2017 17:51:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Oct 2017 17:51:06 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 03 19:50:59 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzRLO-0001Ev-22 for ged-emacs-devel@m.gmane.org; Tue, 03 Oct 2017 19:50:58 +0200 Original-Received: from localhost ([::1]:59701 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzRLV-0000ni-Ef for ged-emacs-devel@m.gmane.org; Tue, 03 Oct 2017 13:51:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dzRLH-0000mH-KL for emacs-devel@gnu.org; Tue, 03 Oct 2017 13:50:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dzRLE-0000rj-Hf for emacs-devel@gnu.org; Tue, 03 Oct 2017 13:50:51 -0400 Original-Received: from [195.159.176.226] (port=41851 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dzRLE-0000rG-AG for emacs-devel@gnu.org; Tue, 03 Oct 2017 13:50:48 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dzRKu-0006ea-Mm for emacs-devel@gnu.org; Tue, 03 Oct 2017 19:50:28 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 17 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:eI68crwXI6VPztnHT28NfE4cAcg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:219048 Archived-At: > Personally, for errors like this, I would typically include the function > name reference so that the location is obvious and users without debug > symbols in their Emacs could still report a more useful error. > Is this doable? A good idea? I think it's desirable, yes. The problem is how to do it. I guess we could try to replace `Ferror` with a C macro that pushes some caller-info onto the Lisp backtrace before signaling the error (a bit like we currently push some pseudo-function onto that stack trace during garbage collection and redisplay). It won't handle the cases where we call `Fsignal` instead, nor the cases where we call some generic C function which then calls Ferror, so to make it really work well, it'll require more manual work to place the caller-info at the "right" spot. Stefan