From unknown Sun Jun 22 07:55:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10597: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absence of debug information. Resent-From: Kaushik Srenevasan Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2012 08:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10597 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 10597@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: ksrenevasan@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.132747887911967 (code B ref -1); Wed, 25 Jan 2012 08:08:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2012 08:07:59 +0000 Received: from localhost ([127.0.0.1]:42526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rpxtf-00036y-2z for submit@debbugs.gnu.org; Wed, 25 Jan 2012 03:07:59 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46684) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rpwkd-0001Qd-0n for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rpwk8-000763-5m for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:36227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk8-00075u-3f for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:04 -0500 Received: from eggs.gnu.org ([140.186.70.92]:36446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk7-00080J-4c for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rpwk5-00075e-V5 for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:03 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:62451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk5-00075Z-Ru for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:01 -0500 Received: by iadk27 with SMTP id k27so2525980iad.0 for ; Tue, 24 Jan 2012 22:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:reply-to:to:content-type:date:message-id:mime-version :x-mailer; bh=N9drUJ0w0sl9qrXQh0cZB1Hqh3Pa+trSvi9CKSAEbwg=; b=aRPdEvS/qWGEgcOMlEmP5ItOw+y8a8cNGaZ+4X+VjyVQUHfr40ChyR8CZCFcHzW71E +Ftx11v8XPxIqkIrQ+HL2lZRF6/226zZED2G3T9lVZ0ZvLeBI8iEUrv7r8PHipmf1Sbz TvrcrJaaVz4gwkQ0+30ewXRicmuGbOcdwbXs8= Received: by 10.50.216.201 with SMTP id os9mr6612450igc.22.1327474440331; Tue, 24 Jan 2012 22:54:00 -0800 (PST) Received: from [192.168.2.3] (c-98-237-183-126.hsd1.wa.comcast.net. [98.237.183.126]) by mx.google.com with ESMTPS id l35sm63519564ibj.0.2012.01.24.22.53.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jan 2012 22:53:59 -0800 (PST) From: Kaushik Srenevasan Content-Type: multipart/mixed; boundary="=-CxfemwgPJHrQe9wrbG/H" Date: Tue, 24 Jan 2012 22:53:15 -0800 Message-ID: <1327474395.11160.4.camel@garuda3.sysenter> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-Mailman-Approved-At: Wed, 25 Jan 2012 03:07:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) --=-CxfemwgPJHrQe9wrbG/H Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Package: emacs Tags: patch Severity: wishlist GUD-MI's disassembly buffer only works when the current frame has debug information. While debugging dynamically generated code it'd be useful to simply follow the program counter. I understand that newer GDBs expose an API that lets a JIT compiler register debug information for dynamically generated code, but JITs typically only do so for real functions. So, having the disassembly buffer follow $PC would still be useful while stepping through dynamically generated, shorter sequences of code (like call stubs, inline caches etc.). The latest GDB (7.4.50.20120122-cvs) does this in its TUI mode while my stable GDB's (7.0.1-debian) behavior is the same as Emacs 23 GUD. Please review and merge. Thanks, -Kaushik --=-CxfemwgPJHrQe9wrbG/H Content-Disposition: attachment; filename="gdb-mi-disassembly-follow-pc.patch" Content-Type: text/x-patch; name="gdb-mi-disassembly-follow-pc.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit === modified file 'lisp/progmodes/gdb-mi.el' --- lisp/progmodes/gdb-mi.el 2012-01-05 09:46:05 +0000 +++ lisp/progmodes/gdb-mi.el 2012-01-24 05:13:10 +0000 @@ -3259,8 +3259,12 @@ (let* ((frame (gdb-current-buffer-frame)) (file (bindat-get-field frame 'fullname)) (line (bindat-get-field frame 'line))) - (when file - (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line))) + (if file + (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line) + ;; If we're unable to get a file name / line for $PC, simply + ;; follow $PC, disassembling the next 10 (x ~15 (on IA) == + ;; 150 bytes) instructions. + "-data-disassemble -s $pc -e \"$pc + 150\" -- 0")) gdb-disassembly-handler ;; We update disassembly only after we have actual frame information ;; about all threads, so no there's `update' signal in this list @@ -3319,8 +3323,12 @@ (gdb-table-add-row table (list (bindat-get-field instr 'address) - (apply #'format "<%s+%s>:" - (gdb-get-many-fields instr 'func-name 'offset)) + (let + ((func-name (bindat-get-field instr 'func-name)) + (offset (bindat-get-field instr 'offset))) + (if func-name + (format "<%s+%s>:" func-name offset) + "")) (bindat-get-field instr 'inst))) (when (string-equal (bindat-get-field instr 'address) address) --=-CxfemwgPJHrQe9wrbG/H-- From unknown Sun Jun 22 07:55:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: ksrenevasan@gmail.com Subject: bug#10597: closed (Re: bug#10597: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absence of debug information.) Message-ID: References: <6p1uoxkmca.fsf@fencepost.gnu.org> <1327474395.11160.4.camel@garuda3.sysenter> X-Gnu-PR-Message: they-closed 10597 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 10597@debbugs.gnu.org Date: Tue, 13 Mar 2012 07:41:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1331624463-9000-1" This is a multi-part message in MIME format... ------------=_1331624463-9000-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #10597: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absenc= e of debug information. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 10597@debbugs.gnu.org. --=20 10597: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D10597 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1331624463-9000-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 10597-done) by debbugs.gnu.org; 13 Mar 2012 07:40:28 +0000 Received: from localhost ([127.0.0.1]:47980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7MLL-0002KQ-Ob for submit@debbugs.gnu.org; Tue, 13 Mar 2012 03:40:28 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:49716) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S7MLJ-0002KI-CP for 10597-done@debbugs.gnu.org; Tue, 13 Mar 2012 03:40:26 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1S7LsL-0001IA-Pb; Tue, 13 Mar 2012 03:10:29 -0400 From: Glenn Morris To: 10597-done@debbugs.gnu.org Subject: Re: bug#10597: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absence of debug information. References: <1327474395.11160.4.camel@garuda3.sysenter> X-Spook: Indigo genetic nitrate AMEMB New World Order kibo X-Ran: %+Xp;a1f&VHZg1_$`v\MBOP|LLrx.\uQmo3BK)*QYJ&)N"Ez{])cqOrR~zA8i4kBzw!WJo X-Hue: blue X-Attribution: GM Date: Tue, 13 Mar 2012 03:10:29 -0400 In-Reply-To: <1327474395.11160.4.camel@garuda3.sysenter> (Kaushik Srenevasan's message of "Tue, 24 Jan 2012 22:53:15 -0800") Message-ID: <6p1uoxkmca.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 10597-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Version: 24.0.95 Thanks; applied. It would be great if you could also suggest ChangeLog entries for any future changes. Also, we'll need a copyright assignment to accept any further changes of more than a few lines total from you. It's a straightforward procedure. Let me know off-list if you want to, and I can send you the form. ------------=_1331624463-9000-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Jan 2012 08:07:59 +0000 Received: from localhost ([127.0.0.1]:42526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rpxtf-00036y-2z for submit@debbugs.gnu.org; Wed, 25 Jan 2012 03:07:59 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46684) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rpwkd-0001Qd-0n for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rpwk8-000763-5m for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:05 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:36227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk8-00075u-3f for submit@debbugs.gnu.org; Wed, 25 Jan 2012 01:54:04 -0500 Received: from eggs.gnu.org ([140.186.70.92]:36446) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk7-00080J-4c for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rpwk5-00075e-V5 for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:03 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:62451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rpwk5-00075Z-Ru for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2012 01:54:01 -0500 Received: by iadk27 with SMTP id k27so2525980iad.0 for ; Tue, 24 Jan 2012 22:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:reply-to:to:content-type:date:message-id:mime-version :x-mailer; bh=N9drUJ0w0sl9qrXQh0cZB1Hqh3Pa+trSvi9CKSAEbwg=; b=aRPdEvS/qWGEgcOMlEmP5ItOw+y8a8cNGaZ+4X+VjyVQUHfr40ChyR8CZCFcHzW71E +Ftx11v8XPxIqkIrQ+HL2lZRF6/226zZED2G3T9lVZ0ZvLeBI8iEUrv7r8PHipmf1Sbz TvrcrJaaVz4gwkQ0+30ewXRicmuGbOcdwbXs8= Received: by 10.50.216.201 with SMTP id os9mr6612450igc.22.1327474440331; Tue, 24 Jan 2012 22:54:00 -0800 (PST) Received: from [192.168.2.3] (c-98-237-183-126.hsd1.wa.comcast.net. [98.237.183.126]) by mx.google.com with ESMTPS id l35sm63519564ibj.0.2012.01.24.22.53.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jan 2012 22:53:59 -0800 (PST) Subject: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absence of debug information. From: Kaushik Srenevasan To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="=-CxfemwgPJHrQe9wrbG/H" Date: Tue, 24 Jan 2012 22:53:15 -0800 Message-ID: <1327474395.11160.4.camel@garuda3.sysenter> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -3.4 (---) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 25 Jan 2012 03:07:57 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: ksrenevasan@gmail.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) --=-CxfemwgPJHrQe9wrbG/H Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Package: emacs Tags: patch Severity: wishlist GUD-MI's disassembly buffer only works when the current frame has debug information. While debugging dynamically generated code it'd be useful to simply follow the program counter. I understand that newer GDBs expose an API that lets a JIT compiler register debug information for dynamically generated code, but JITs typically only do so for real functions. So, having the disassembly buffer follow $PC would still be useful while stepping through dynamically generated, shorter sequences of code (like call stubs, inline caches etc.). The latest GDB (7.4.50.20120122-cvs) does this in its TUI mode while my stable GDB's (7.0.1-debian) behavior is the same as Emacs 23 GUD. Please review and merge. Thanks, -Kaushik --=-CxfemwgPJHrQe9wrbG/H Content-Disposition: attachment; filename="gdb-mi-disassembly-follow-pc.patch" Content-Type: text/x-patch; name="gdb-mi-disassembly-follow-pc.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit === modified file 'lisp/progmodes/gdb-mi.el' --- lisp/progmodes/gdb-mi.el 2012-01-05 09:46:05 +0000 +++ lisp/progmodes/gdb-mi.el 2012-01-24 05:13:10 +0000 @@ -3259,8 +3259,12 @@ (let* ((frame (gdb-current-buffer-frame)) (file (bindat-get-field frame 'fullname)) (line (bindat-get-field frame 'line))) - (when file - (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line))) + (if file + (format "-data-disassemble -f %s -l %s -n -1 -- 0" file line) + ;; If we're unable to get a file name / line for $PC, simply + ;; follow $PC, disassembling the next 10 (x ~15 (on IA) == + ;; 150 bytes) instructions. + "-data-disassemble -s $pc -e \"$pc + 150\" -- 0")) gdb-disassembly-handler ;; We update disassembly only after we have actual frame information ;; about all threads, so no there's `update' signal in this list @@ -3319,8 +3323,12 @@ (gdb-table-add-row table (list (bindat-get-field instr 'address) - (apply #'format "<%s+%s>:" - (gdb-get-many-fields instr 'func-name 'offset)) + (let + ((func-name (bindat-get-field instr 'func-name)) + (offset (bindat-get-field instr 'offset))) + (if func-name + (format "<%s+%s>:" func-name offset) + "")) (bindat-get-field instr 'inst))) (when (string-equal (bindat-get-field instr 'address) address) --=-CxfemwgPJHrQe9wrbG/H-- ------------=_1331624463-9000-1--