From patchwork Fri Oct 28 20:44:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Arsen_Arsenovi=C4=87?= X-Patchwork-Id: 59603 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2DAC33858C2C for ; Fri, 28 Oct 2022 20:48:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DAC33858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666990113; bh=bAdGNt73417UaOwFHFvSTF6CDKAEnVydo0h9HMO/4yk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:From; b=ygE+g8c3jQg1xh1ouzfmS2hMKGc5bx/D5ixjiWCXxQulEv2jYS/OTSf+8/a16A6HJ VbXM8hLYv0T6X3BHlFs5LgwMybg9aZqLBhCDsbraAWQqg7M2PJzOdNiqH5n6VkGUNH XsXlqSI9EQBsdlwz1KzWiw05HXGgoo81O0bQ4yWg= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [IPv6:2001:67c:2050:0:465::201]) by sourceware.org (Postfix) with ESMTPS id 0E9053858D20 for ; Fri, 28 Oct 2022 20:48:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0E9053858D20 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4MzZPR4WCRz9sST; Fri, 28 Oct 2022 22:47:55 +0200 (CEST) To: elfutils-devel@sourceware.org Subject: [PATCH] readelf: add binutils-style --syms option Date: Fri, 28 Oct 2022 22:44:47 +0200 Message-Id: <20221028204446.528004-1-arsen@aarsen.me> MIME-Version: 1.0 X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Arsen_Arsenovi=C4=87_via_Elfutils-devel?= From: =?utf-8?q?Arsen_Arsenovi=C4=87?= Reply-To: =?utf-8?q?Arsen_Arsenovi=C4=87?= Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" This helps people with a lot of built up muscle memory :) Signed-off-by: Arsen Arsenović --- Hi there! I often use the "medium length" form of --symbols when using readelf, and I've been trying to switch to eu-readelf lately (for various reasons); this alias comes in handy for this reason. I also added the matching tests, though I'm not sure if they're strictly necessary (but I added them anyway). Some of the .po files need regenerating, I didn't include that here because it was a massive diff. Thanks in advance, and have a great evening! doc/ChangeLog | 4 ++++ doc/readelf.1 | 5 ++++- src/ChangeLog | 4 ++++ src/readelf.c | 1 + tests/ChangeLog | 4 ++++ tests/run-readelf-s.sh | 6 ++++++ 6 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 073023b4..269ed06e 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2022-10-28 Arsen Arsenović + + * readelf.1: Document the --syms alias. + 2022-10-18 Daniel Thornburgh * debuginfod_find_debuginfo.3: Document DEBUGINFOD_HEADERS_FILE. diff --git a/doc/readelf.1 b/doc/readelf.1 index 6a843f66..1d182071 100644 --- a/doc/readelf.1 +++ b/doc/readelf.1 @@ -146,7 +146,7 @@ eu-readelf [\fB\-a\fR|\fB\-\-all\fR] [\fB\-S\fR|\fB\-\-section\-headers\fR|\fB\-\-sections\fR] [\fB\-g\fR|\fB\-\-section\-groups\fR] [\fB\-e\fR|\fB\-\-exception\fR] - [\fB\-s\fR|\fB\-\-symbols\fR] [section name] ] + [\fB\-\-syms\fR|\fB\-s\fR|\fB\-\-symbols\fR [section name] ] [\fB\-\-dyn-syms\fR] [\fB\-n\fR|\fB\-\-notes\fR [section name] ] [\fB\-r\fR|\fB\-\-relocs\fR] @@ -255,6 +255,9 @@ of the symbol tables. .IP "\fB\-s\fR" 4 .IX Item "-s" .PD 0 +.IP "\fB\--syms\fR" 4 +.IX Item "--syms" +.PD 0 .IP "\fB\-\-symbols\fR [section name]" 4 .IX Item "--symbols" .PD diff --git a/src/ChangeLog b/src/ChangeLog index 1f369ef6..d3399a5c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2022-10-28 Arsen Arsenović + + * readelf.c (options): Add Binutils-style --syms alias. + 2022-10-19 Mark Wielaard * readelf.c (dwarf_loc_list_encoding_string): Handle diff --git a/src/readelf.c b/src/readelf.c index 7671a31d..0e0b05c4 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -115,6 +115,7 @@ static const struct argp_option options[] = { "sections", 'S', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, { "symbols", 's', "SECTION", OPTION_ARG_OPTIONAL, N_("Display the symbol table sections"), 0 }, + { "syms", 's', NULL, OPTION_ALIAS | OPTION_HIDDEN, NULL, 0 }, { "dyn-syms", PRINT_DYNSYM_TABLE, NULL, 0, N_("Display (only) the dynamic symbol table"), 0 }, { "version-info", 'V', NULL, 0, N_("Display versioning information"), 0 }, diff --git a/tests/ChangeLog b/tests/ChangeLog index be90832a..949dab8a 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,7 @@ +2022-10-28 Arsen Arsenović + + * run-readelf-s.sh: Add tests for the --syms alias. + 2022-10-27 Mark Wielaard * backtrace-subr.sh: Use grep -E instead of egrep, use grep -F diff --git a/tests/run-readelf-s.sh b/tests/run-readelf-s.sh index 527c436c..ee1c0e82 100755 --- a/tests/run-readelf-s.sh +++ b/tests/run-readelf-s.sh @@ -277,10 +277,16 @@ EOF cat testfile.dynsym.in testfile.symtab.in \ | testrun_compare ${abs_top_builddir}/src/readelf -s testfilebaztab +cat testfile.dynsym.in testfile.symtab.in \ + | testrun_compare ${abs_top_builddir}/src/readelf --syms testfilebaztab + # Display just .dynsym cat testfile.dynsym.in \ | testrun_compare ${abs_top_builddir}/src/readelf \ --symbols=.dynsym testfilebaztab +cat testfile.dynsym.in \ + | testrun_compare ${abs_top_builddir}/src/readelf \ + --syms=.dynsym testfilebaztab cat testfile.dynsym.in \ | testrun_compare ${abs_top_builddir}/src/readelf \ --dyn-syms testfilebaztab