From patchwork Thu Feb 9 20:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 55093 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp567094wrn; Thu, 9 Feb 2023 12:51:04 -0800 (PST) X-Google-Smtp-Source: AK7set8Zpx5pHwhB3OllavkZ265F+n7CvQMTOjf/0r4NB44Pw5c5zVkw7h6hdPuiQoHDYGhowVfH X-Received: by 2002:a17:906:7f10:b0:881:d1ad:1640 with SMTP id d16-20020a1709067f1000b00881d1ad1640mr12490432ejr.57.1675975864290; Thu, 09 Feb 2023 12:51:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675975864; cv=none; d=google.com; s=arc-20160816; b=0oagTC9674kXjJ4sMLKSodTfE3PUynGcnddlB9Upk9Y0YDHVeEOU3sOaGhmXMrlNNW 37kHv4iXTZkk8+VCFggq6NFHl+VC+aLTdeAn5+FAG2T3wm9+aNKsr1CsWb1UAkfStRNi mGCO1LZCqjFO1kJyv+6zB3PQMPpFM6+F0CC5ZBFBULZolNjNHwdMUeJGtZJvYaoX+djh F3EXUOfB4nUQuvvXri/v8nVeA9VbJf/ZgZtSG4JPQflcdFZmoZak+b+WNUJOYdCzYsgG S8sDgMArKXdos8aa4/gnMCMFr583Zf/iERxpmrnpfrRun/DvCTdneCptqxsbP8eA2bz7 RmAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=O2UNI597D47qGLGB8LYu80F4OYdmJm2ZVcZ9rMS15u8=; b=s5VJzaZU2hgAN40aHfT1QFL9wmy5tBnwvA02EUkvoRvFmcK1spEnlYgXixishYwXb5 l2ngDIW6/mrCIr/Xb9yeFK8fCKxUqvoLx7dYA9G/ucSbeBjNyy4bI1Cbb3wWxYhlX9AA lppittlGCzmOgneJdMwqWL7woPBlz2p8CPyptjkNPepj97pEx5Hwe/CFNmaHeq95sspr 8rCBdeidQKAzMLoVC3SKHPz2sG3BuJV/e2Jnnj6wj6zSr9bj2CQFWLOioXrY3EDnAnb5 zbEwVNoZZaHzNF7kaIDupEiJvQry8U1aRRLwz0OUSQUPkHrvfwm4iZlo2rjUM5TbMFpa bU7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=xVwZqriK; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 30-20020a170906029e00b00888161349ddsi4296019ejf.661.2023.02.09.12.51.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 12:51:04 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=xVwZqriK; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F06953858022 for ; Thu, 9 Feb 2023 20:51:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F06953858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675975863; bh=O2UNI597D47qGLGB8LYu80F4OYdmJm2ZVcZ9rMS15u8=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=xVwZqriKt9vTMvawCXPkJ1EZoqxjQN4+zXMmkiIdM+g9QY71c+UGbVsEC2WbSECp6 Elo1BGZAy5unCctIS881mQ6n/1sPvANdkxK1pWiIA6oE0B/LkNN7OGWPFaxB6o/Qfi jikb4HGmxMGkS6Q+EGTDgM+y3P4DEB0v4kzx8lCo= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) by sourceware.org (Postfix) with ESMTPS id ACA9D3858C5F for ; Thu, 9 Feb 2023 20:50:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ACA9D3858C5F Received: by mail-il1-x133.google.com with SMTP id b9so1372455ilh.12 for ; Thu, 09 Feb 2023 12:50:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=O2UNI597D47qGLGB8LYu80F4OYdmJm2ZVcZ9rMS15u8=; b=kJIXnDZcHpDAQtahEF5bTn64s04b8eakTw/cMIwgB/yjFJDzfevuRIhPMSPBiVbS3O U0n/ZwdC0n0rZW9k9y+BUJA2WvKXoxPaq13hc2Qj3DsQ6W+t86HWrxoe+FPI/S+/cVH0 Np99d7OpoSzImRoFR4Yp/VsLyVU7aU58b2DQW5c8DbuJ3wdgvFbSkxH9RGusvbJfmcdM uFARndV3bPYOv3S0uz+hTISH+PcR9kZclKZk9gBXQ8gpL9/a93gI5DNXFYR5glp+cVoc NPPb0MqkW8BxgFjtc/UjwgCSr6yYwiXcseA0woprucDHT/kB+gdPnF/Oo84lztQFWkiw sRsA== X-Gm-Message-State: AO0yUKVXJF92R5y559eNpqlZfxa/2ATwDmkCqRScj6xysvS2zDSXuz1h Bi6F46F9oXOCvAKiJDVcF6mS7EkhV/fdvvIu X-Received: by 2002:a05:6e02:20ef:b0:30b:e45c:3d1a with SMTP id q15-20020a056e0220ef00b0030be45c3d1amr14082494ilv.23.1675975853702; Thu, 09 Feb 2023 12:50:53 -0800 (PST) Received: from localhost.localdomain (75-166-130-93.hlrn.qwest.net. [75.166.130.93]) by smtp.gmail.com with ESMTPSA id g18-20020a0566380c5200b003b0692eb199sm766657jal.20.2023.02.09.12.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 12:50:53 -0800 (PST) To: binutils@sourceware.org Cc: Tom Tromey Subject: [pushed] Add full display feature to dwarf-mode.el Date: Thu, 9 Feb 2023 13:50:40 -0700 Message-Id: <20230209205040.1286063-1-tromey@adacore.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Binutils From: Tom Tromey Reply-To: Tom Tromey Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757388067635632258?= X-GMAIL-MSGID: =?utf-8?q?1757388067635632258?= I've found that I often use dwarf-mode with relatively small test files. In this situation, it's handy to be able to expand all the DWARF, rather than moving to each "..." separately and using C-u C-m. This patch implements this feature. It also makes a couple of other minor changes: * I removed a stale FIXME from dwarf-mode. In practice I find I often use "g" to restore the buffer to a pristine state; checking the file mtime would work against this. * I tightened the regexp in dwarf-insert-substructure. This prevents the C-m binding from trying to re-read a DIE which has already been expanded. * Finally, I've bumped the dwarf-mode version number so that this version can easily be installed using package.el. 2023-02-09 Tom Tromey * dwarf-mode.el: Bump version to 1.8. (dwarf-insert-substructure): Tighten regexp. (dwarf-refresh-all): New defun. (dwarf-mode-map): Bind "A" to dwarf-refresh-all. (dwarf-mode): Remove old FIXME. --- binutils/ChangeLog | 8 ++++++++ binutils/dwarf-mode.el | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/binutils/dwarf-mode.el b/binutils/dwarf-mode.el index 82f6753b1e5..3ab2e188478 100644 --- a/binutils/dwarf-mode.el +++ b/binutils/dwarf-mode.el @@ -1,6 +1,6 @@ ;;; dwarf-mode.el --- Browser for DWARF information. -*-lexical-binding:t-*- -;; Version: 1.7 +;; Version: 1.8 ;; Copyright (C) 2012-2023 Free Software Foundation, Inc. @@ -111,7 +111,7 @@ By default, expands just one level of children. A prefix argument means expand all children." (interactive "P") (beginning-of-line) - (unless (looking-at "^ <\\([0-9]+\\)><\\([0-9a-f]+\\)>") + (unless (looking-at "^ <\\([0-9]+\\)><\\([0-9a-f]+\\)>: \\.\\.\\.") (error "Unrecognized line.")) (let ((die (match-string 2))) (if arg @@ -185,6 +185,17 @@ A prefix argument means expand all children." (expand-file-name dwarf-file)) (set-buffer-modified-p nil))) +(defun dwarf-refresh-all () + "Refresh the current buffer without eliding substructure. +Note that this can result in very voluminous output." + (interactive) + (dwarf--check-running) + (let ((inhibit-read-only t)) + (dwarf--invoke (point-min) (point-max) + dwarf-objdump-program "-Wi" + (expand-file-name dwarf-file)) + (set-buffer-modified-p nil))) + (defvar dwarf-mode-syntax-table (let ((table (make-syntax-table))) ;; This at least makes it so mark-sexp on some hex digits inside @@ -198,6 +209,7 @@ A prefix argument means expand all children." (let ((map (make-sparse-keymap))) (set-keymap-parent map special-mode-map) (define-key map [(control ?m)] #'dwarf-insert-substructure) + (define-key map "A" #'dwarf-refresh-all) map) "Keymap for dwarf-mode buffers.") @@ -207,7 +219,6 @@ A prefix argument means expand all children." \\{dwarf-mode-map}" (set (make-local-variable 'font-lock-defaults) '(dwarf-font-lock-keywords)) - ;; FIXME: we could be smarter and check the file time. (set (make-local-variable 'revert-buffer-function) #'dwarf-do-refresh) (jit-lock-register #'dwarf-fontify-region))