From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Gemini Lasswell Newsgroups: gmane.emacs.bugs Subject: bug#25393: FEATURE REQUEST: *Backtrace* -- C source code def highlight + jump to def. Date: Wed, 08 Aug 2018 17:11:21 -0700 Message-ID: <87sh3oe6vq.fsf@runbox.com> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1533773410 31497 195.159.176.226 (9 Aug 2018 00:10:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Aug 2018 00:10:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) Cc: 25393@debbugs.gnu.org, =?UTF-8?Q?Cl=C3=A9ment?= Pit-Claudel To: Keith David Bershatsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Aug 09 02:10:05 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fnYWi-00084E-1m for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Aug 2018 02:10:04 +0200 Original-Received: from localhost ([::1]:45986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnYYo-0004nn-IN for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Aug 2018 20:12:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fnYYh-0004nV-At for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2018 20:12:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fnYYd-0000Rx-0z for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2018 20:12:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40366) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fnYYc-0000Rf-M9 for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2018 20:12:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fnYYc-0006hl-Dg for bug-gnu-emacs@gnu.org; Wed, 08 Aug 2018 20:12:02 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 25393-submit@debbugs.gnu.org id=B25393.153377349625737 (code B ref 25393); Thu, 09 Aug 2018 00:12:02 +0000 Original-Received: (at 25393) by debbugs.gnu.org; 9 Aug 2018 00:11:36 +0000 Original-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 Original-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==; Original-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 Original-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 In-Reply-To: (Keith David Bershatsky's message of "Sun, 08 Jan 2017 00:29:13 -0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:149365 Archived-At: --=-=-= 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 --=-=-=--