From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushik Srenevasan Newsgroups: gmane.emacs.devel Subject: [PATCH] GUD-MI's disassembly buffer should follow $PC in the absence of debug information. Date: Mon, 23 Jan 2012 22:46:47 -0800 Message-ID: <1327387607.1742.21.camel@garuda3.sysenter> Reply-To: ksrenevasan@gmail.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1327387666 5363 80.91.229.12 (24 Jan 2012 06:47:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 24 Jan 2012 06:47:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 24 07:47:42 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RpaAO-0002Ko-UV for ged-emacs-devel@m.gmane.org; Tue, 24 Jan 2012 07:47:41 +0100 Original-Received: from localhost ([::1]:50465 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpaAN-0000Gt-Ej for ged-emacs-devel@m.gmane.org; Tue, 24 Jan 2012 01:47:39 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpaAL-0000Go-95 for emacs-devel@gnu.org; Tue, 24 Jan 2012 01:47:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RpaAK-0000qi-6K for emacs-devel@gnu.org; Tue, 24 Jan 2012 01:47:37 -0500 Original-Received: from mail-iy0-f169.google.com ([209.85.210.169]:44249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RpaAK-0000qb-39 for emacs-devel@gnu.org; Tue, 24 Jan 2012 01:47:36 -0500 Original-Received: by iadk27 with SMTP id k27so634363iad.0 for ; Mon, 23 Jan 2012 22:47:34 -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:content-transfer-encoding; bh=EX/ABC5WpY/IcnbChaYvV0quE6FLZFX3FHCAfxYAxlM=; b=xYmUOrR9nTRZXRAK3zrEx86jwA3oInyOf90Rn0MF95BVuK+H84p1vY53TjSornNdha 1+O7d1PdWSfC5DOvbim47kg6fr34iE4uqknLruODHvvsafXC6MeoY3qKpnsY1H4o8l8t KHA2NLdJJh8N1ZZOR2WjotFKuWSOBLMMqUdOY= Original-Received: by 10.42.131.136 with SMTP id z8mr10794529ics.5.1327387654671; Mon, 23 Jan 2012 22:47:34 -0800 (PST) Original-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 h9sm55400339ibh.11.2012.01.23.22.47.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 22:47:33 -0800 (PST) X-Mailer: Evolution 2.30.3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.169 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:147865 Archived-At: All, 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 === 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)