From unknown Sun Jun 22 00:10:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25393: FEATURE REQUEST: *Backtrace* -- C source code def highlight + jump to def. Resent-From: Keith David Bershatsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 08 Jan 2017 08:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25393 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 25393@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.148386423027362 (code B ref -1); Sun, 08 Jan 2017 08:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Jan 2017 08:30:30 +0000 Received: from localhost ([127.0.0.1]:46465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ8s2-00077G-1Q for submit@debbugs.gnu.org; Sun, 08 Jan 2017 03:30:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38780) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cQ8rz-000773-S2 for submit@debbugs.gnu.org; Sun, 08 Jan 2017 03:30:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ8rs-0006oT-Vm for submit@debbugs.gnu.org; Sun, 08 Jan 2017 03:30:22 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:59034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cQ8rs-0006o2-Rp for submit@debbugs.gnu.org; Sun, 08 Jan 2017 03:30:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57960) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cQ8rq-0002m8-Ny for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 03:30:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cQ8rn-0006kL-EL for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 03:30:18 -0500 Received: from nov-007-i629.relay.mailchannels.net ([46.232.183.183]:32231) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cQ8rm-0006DU-AD for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 03:30:15 -0500 X-Sender-Id: techassets|x-authuser|lawlist@cp31.deluxehosting.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 63918100349 for ; Sun, 8 Jan 2017 08:29:22 +0000 (UTC) Received: from cp31.deluxehosting.com (ip-10-107-69-155.us-west-2.compute.internal [10.107.69.155]) by relay.mailchannels.net (Postfix) with ESMTPA id 894151003C8 for ; Sun, 8 Jan 2017 08:29:21 +0000 (UTC) X-Sender-Id: techassets|x-authuser|lawlist@cp31.deluxehosting.com Received: from cp31.deluxehosting.com ([TEMPUNAVAIL]. [10.135.9.54]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.7.8); Sun, 08 Jan 2017 08:29:22 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: techassets|x-authuser|lawlist@cp31.deluxehosting.com X-MailChannels-Auth-Id: techassets X-MC-Loop-Signature: 1483864161783:3861589591 X-MC-Ingress-Time: 1483864161782 Received: from cpe-45-48-239-195.socal.res.rr.com ([45.48.239.195]:57512 helo=server.local) by cp31.deluxehosting.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.87) (envelope-from ) id 1cQ8qp-000693-B1 for bug-gnu-emacs@gnu.org; Sun, 08 Jan 2017 03:29:15 -0500 Date: Sun, 08 Jan 2017 00:29:13 -0800 Message-ID: From: Keith David Bershatsky MIME-Version: 1.0 (generated by - "") Content-Type: text/plain; charset=US-ASCII X-AuthUser: lawlist@cp31.deluxehosting.com X-Originating-IP: 45.48.239.195 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.4 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.4 (----) As a feature request, the Emacs team may wish to consider implementing the ability for users to highlight C source code definitions in the *Backtrace* buffer and jump to the function definitions. The highlighting of said functions makes the *Backtrace* buffer prettier, and it's handy to jump to the definitions with buttons. A check should probably be included to see whether the `find-function-C-source-directory' contains C source code files before creating highlighting/buttons for jumping: Here is the link to the related thread: http://emacs.stackexchange.com/questions/29875/debugging-debugger-mode-how-to-highlight-the-culprit In my use-case, it wasn't very obvious to me that `/` was the cause of my backtrace error message because it was not highlighted -- this is true even though I am aware that the problem is always near the top of the debugger buffer. It is just not a function I use a lot and it didn't really look like a function because it was just regular text coloration. (require 'debug) (defun debugger-make-xrefs (&optional buffer) "Attach cross-references to function names in the `*Backtrace*' buffer." (interactive "b") (with-current-buffer (or buffer (current-buffer)) (save-excursion (setq buffer (current-buffer)) (let ((inhibit-read-only t) (old-end (point-min)) (new-end (point-min))) (if debugger-previous-backtrace (let (old-start new-start (all-match t)) (goto-char (point-max)) (with-temp-buffer (insert debugger-previous-backtrace) (while (and all-match (not (bobp))) (setq old-end (point)) (forward-line -1) (setq old-start (point)) (with-current-buffer buffer (setq new-end (point)) (forward-line -1) (setq new-start (point))) (if (not (zerop (let ((case-fold-search nil)) (compare-buffer-substrings (current-buffer) old-start old-end buffer new-start new-end)))) (setq all-match nil)))) (delete-region new-end (point-max)) (goto-char (point-max)) (insert (substring debugger-previous-backtrace (- old-end (point-min)))) (narrow-to-region (point-min) new-end))) (goto-char (point-min)) (while (progn (goto-char (+ (point) 2)) (skip-syntax-forward "^w_") (not (eobp))) (let* ((beg (point)) (end (progn (skip-syntax-forward "w_") (point))) (fn (function-called-at-point)) ;; MODIFICATION (sym (intern-soft (buffer-substring-no-properties beg end))) ;; MODIFICATION (file (if fn (let* ( (function fn) (advised (and (symbolp function) (featurep 'nadvice) (advice--p (advice--symbol-function function)))) ;; If the function is advised, use the symbol that has the ;; real definition, if that symbol is already set up. (real-function (or (and advised (advice--cd*r (advice--symbol-function function))) function)) ;; Get the real definition. (def (if (symbolp real-function) (or (symbol-function real-function) (signal 'void-function (list real-function))) real-function)) (aliased (or (symbolp def) ;; Advised & aliased function. (and advised (symbolp real-function) (not (eq 'autoload (car-safe def)))))) (file-name (find-lisp-object-file-name function (if aliased 'defun def)))) file-name) (and sym (symbol-file sym 'defun))))) (when (or fn file) ;; MODIFICATION (goto-char beg) (re-search-forward "\\(\\sw\\|\\s_\\)+") (help-xref-button 0 'help-function-def sym file))) (forward-line 1)) (widen)) (setq debugger-previous-backtrace (buffer-string))))) From unknown Sun Jun 22 00:10:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25393: FEATURE REQUEST: *Backtrace* -- C source code def highlight + jump to def. Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Aug 2018 00:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25393 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Keith David Bershatsky Cc: 25393@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Received: via spool by 25393-submit@debbugs.gnu.org id=B25393.153377349625737 (code B ref 25393); Thu, 09 Aug 2018 00:12:02 +0000 Received: (at 25393) by debbugs.gnu.org; 9 Aug 2018 00:11:36 +0000 Received: from localhost ([127.0.0.1]:45384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnYYC-0006h2-Ck for submit@debbugs.gnu.org; Wed, 08 Aug 2018 20:11:36 -0400 Received: from aibo.runbox.com ([91.220.196.211]:41784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fnYYA-0006gu-Bs for 25393@debbugs.gnu.org; Wed, 08 Aug 2018 20:11:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From; bh=j+rjzMFtUjviWRJpIBUsh8cYJLdHPFif839v8lg2Vnc=; b=gFMIc4J2fEnuN8Av77nlCAl16q VtkuSmfy95kU95tzFLTWQQ+1IhU0bjYY7tFbujKabBhqS9OwHz5fMdMxe7AxKTDWKlmnpvzBhqeDW RWvf7Ft1DpmuljEVF1qQPuBMpzKA99W4jibMjxuUrAUXtIsN/CTbtDqfiIJykvKkigFMY0hVX2tVf kpWUe+C27+nTSSF3sW2wip94mM6GdoKW4j65REJMexlInKbSNMikNkNJ+ZnJwzLmXvT1Hf4x/N56i n3Hv85nc6zkmC0+2pQ0r35Us90WaTp3IB0+GjsdQjrDK4IzWJt+EO5CUy7JoYPwesb669DzRp7aYQ iI/u/j1Q==; Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fnYY8-0004y6-Fe; Thu, 09 Aug 2018 02:11:32 +0200 Received: by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1fnYY0-0000Up-L6; Thu, 09 Aug 2018 02:11:25 +0200 From: Gemini Lasswell References: Date: Wed, 08 Aug 2018 17:11:21 -0700 In-Reply-To: (Keith David Bershatsky's message of "Sun, 08 Jan 2017 00:29:13 -0800") Message-ID: <87sh3oe6vq.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Keith, The new backtrace mode, in the master branch as of da0054c307, makes links for built-in functions. The attached patch improves on current master by making links to C functions work even when those functions are advised. See http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00025.html for Cl=C3=A9ment's report of that problem. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=0001-Fix-links-in-backtraces-to-work-on-advised-built-ins.patch >From 7737f48840d3c07b09506eb4b4743646d27cd2aa Mon Sep 17 00:00:00 2001 From: Gemini Lasswell Date: Tue, 7 Aug 2018 19:39:06 -0700 Subject: [PATCH] Fix links in backtraces to work on advised built-ins (Bug#25393) * lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args): Make links to the original definition of advised functions. Handle the case when the function slot of the backtrace frame contains the definition of a built-in function. --- lisp/emacs-lisp/backtrace.el | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index f13b43b465..e82d4f5a5a 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -34,6 +34,7 @@ (eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'pcase)) (eval-when-compile (require 'subr-x)) ; if-let +(require 'find-func) (require 'help-mode) ; Define `help-function-def' button type. (require 'lisp-mode) @@ -735,11 +736,11 @@ backtrace--print-func-and-args (evald (backtrace-frame-evald frame)) (fun (backtrace-frame-fun frame)) (args (backtrace-frame-args frame)) - (def (and (symbolp fun) (fboundp fun) (symbol-function fun))) + (def (find-function-advised-original fun)) (fun-file (or (symbol-file fun 'defun) - (and (subrp def) - (not (eq 'unevalled (cdr (subr-arity def)))) - (find-lisp-object-file-name fun def)))) + (and (subrp def) + (not (eq 'unevalled (cdr (subr-arity def)))) + (find-lisp-object-file-name fun def)))) (fun-pt (point))) (cond ((and evald (not debugger-stack-frame-as-list)) @@ -762,7 +763,8 @@ backtrace--print-func-and-args (insert (backtrace--print-to-string fun-and-args))) (cl-incf fun-pt))) (when fun-file - (make-text-button fun-pt (+ fun-pt (length (symbol-name fun))) + (make-text-button fun-pt (+ fun-pt + (length (backtrace--print-to-string fun))) :type 'help-function-def 'help-args (list fun fun-file))) ;; After any frame that uses eval-buffer, insert a comment that -- 2.16.4 --=-=-= Content-Type: text/plain Keith David Bershatsky writes: > A check should probably be included to see whether the > `find-function-C-source-directory' contains C source code files before > creating highlighting/buttons for jumping: I chose not to do this. I think it's better to make the buttons and give an error message when they are pressed if 'find-function-C-source-directory' is misconfigured, because then the error message lets the user know that there is a configuration problem so that she or he can try to fix it. Let me know if you are able to give this a try and how it works for you. Thanks, Gemini --=-=-=-- From unknown Sun Jun 22 00:10:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#25393: FEATURE REQUEST: *Backtrace* -- C source code def highlight + jump to def. Resent-From: Gemini Lasswell Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Aug 2018 18:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25393 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Keith David Bershatsky Cc: 25393@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel Received: via spool by 25393-submit@debbugs.gnu.org id=B25393.153539326828306 (code B ref 25393); Mon, 27 Aug 2018 18:08:02 +0000 Received: (at 25393) by debbugs.gnu.org; 27 Aug 2018 18:07:48 +0000 Received: from localhost ([127.0.0.1]:34473 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuLvX-0007MO-W2 for submit@debbugs.gnu.org; Mon, 27 Aug 2018 14:07:48 -0400 Received: from aibo.runbox.com ([91.220.196.211]:38550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuLvW-0007M7-9q for 25393@debbugs.gnu.org; Mon, 27 Aug 2018 14:07:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:In-Reply-To:Date:References:Subject:Cc:To:From; bh=sgrxYH87TYmodjfMHSR4RBF4YzmN3Iiwnw54uMBLoeY=; b=UdVfZUG7UUlEsUhRHFERCvEBKi K9xOtUVCTBrrDA1u2YwUyH72gKP9aZuQXYVdwRGd8s22hkSjvgtSqio6Vosuktxcug7GBIQfpKwIz EL2cGlcUuhCWZjye27gptCRoubP0jzU5VPLkv8dLoTRsxNREY1LrisEGWqLW2sexedx9fVbXuBzx2 2ctS4seZ00qLkN+c7InQSxfy0UgDefTaFyqVOfdpLxABmF4x1NFC7UJnskPJu1AstUW6PK2jAsMxp LqEof2VXF7CqVzI9MjbrJ1HmCulD4CTGeiOb+IM4PvZFq2N08ozfKqQ3qtdQclb8Vh1bvx1u7wDV7 AzJM0FoA==; Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fuLvU-0000qn-AU; Mon, 27 Aug 2018 20:07:44 +0200 Received: by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1fuLv6-0007K5-If; Mon, 27 Aug 2018 20:07:21 +0200 From: Gemini Lasswell References: <87sh3oe6vq.fsf@runbox.com> Date: Mon, 27 Aug 2018 11:07:17 -0700 In-Reply-To: <87sh3oe6vq.fsf@runbox.com> (Gemini Lasswell's message of "Wed, 08 Aug 2018 17:11:21 -0700") Message-ID: <87a7p73cq2.fsf@runbox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Gemini Lasswell writes: > The attached patch improves on current master by making links to C > functions work even when those functions are advised. See > http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00025.html for > Cl=C3=A9ment's report of that problem. I've pushed the patch to master (674f276c0a), and I'm closing this bug. From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 27 14:07:47 2018 Received: (at control) by debbugs.gnu.org; 27 Aug 2018 18:07:48 +0000 Received: from localhost ([127.0.0.1]:34471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuLvX-0007ML-QJ for submit@debbugs.gnu.org; Mon, 27 Aug 2018 14:07:47 -0400 Received: from aibo.runbox.com ([91.220.196.211]:38554) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fuLvW-0007M8-9g for control@debbugs.gnu.org; Mon, 27 Aug 2018 14:07:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=rbselector1; h=Subject:From:To:Message-Id:Date; bh=zb8pPOAFQyf0mJN8Ui9Z4szwmRPYedHqhShLC2QDIf0=; b=Xk604eG9ZGbW/Pc1dq71GxQSXy fmP4NO6LaZIv9cMexvCV6mhg3i719O8GdO9bID21xSBtqyYFfhg2azBB3TtgamikbVNMXh2jhuM3H SCdUpPADFZpf3RsgZvdR4HNKIk0up7YVdRGiQjb64fBz7yhKu3mNA9yq8NTY9pe5r+93+dj+OfR4D ich+fu6Ub/UTch5fNEumPDJPYkdE1TC5hbDig9NcSuc2zVv6qir96aAeLKZzTry3Pel/tfku01FB7 KRPcFmyj5uRZyRVI9gIxrdKvhEI/2S4uVQJkUiYKUY9n1vT+6wVv2rK9QRZFcQf0qXDqDrbo1bvSU YGMucHFQ==; Received: from [10.9.9.211] (helo=mailfront11.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1fuLvV-0000qu-G7 for control@debbugs.gnu.org; Mon, 27 Aug 2018 20:07:45 +0200 Received: by mailfront11.runbox.com with esmtpsa (uid:179284 ) (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1fuLvO-0007XM-G7 for control@debbugs.gnu.org; Mon, 27 Aug 2018 20:07:39 +0200 Date: Mon, 27 Aug 2018 11:07:35 -0700 Message-Id: <878t4r3cpk.fsf@runbox.com> To: control@debbugs.gnu.org From: Gemini Lasswell Subject: control message for bug #25393 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) tags 25393 fixed close 25393 27.1