From patchwork Sat Sep 7 00:38:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 97297 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 893DA385DDD5 for ; Sat, 7 Sep 2024 00:39:34 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 175AB386101E for ; Sat, 7 Sep 2024 00:38:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 175AB386101E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 175AB386101E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725669533; cv=none; b=UnRKj8X7wFAwLtLyKjK39vT2y9MWemKu1v55v/D3/f04pjG1D4ROLombchwaDXpBIg24uIzLdHCgHD1oE28Kv1eMV9/NbsAwTToyzLeJof/nlGKwjiRGOJUzSsWs36fIk0iwn1HWYLpr7oaZWhE8F6/wrkef++LM9hZ/smZqn+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725669533; c=relaxed/simple; bh=O5VE3n6Jolmqfe7xwXXlrldaEJENRtx/UnpfnLR2DBU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=QpD3jLvbx7WHmBk+umzUd5i48ftt+C2y53oOwCxTc6pzk+b56AWisgBLyE/Qb/gytQE25eTqZ+EWh9Xfpo9H7MO1NS4IwZjDEYt0oAc3Jz5YDpv1qou0kkMhiAx3j5pukJtkSB4nimV3l1iGII9dHaDxHzCPvwts8EvC0IFmyvs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 57CB830D0628; Sat, 7 Sep 2024 02:38:48 +0200 (CEST) Received: by r6.localdomain (Postfix, from userid 1000) id F27C134067B; Sat, 7 Sep 2024 02:38:47 +0200 (CEST) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] readelf: Fix printing of .gdb_index symbol table offset. Date: Sat, 7 Sep 2024 02:38:42 +0200 Message-ID: <20240907003842.3726706-1-mark@klomp.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces~patchwork=sourceware.org@sourceware.org We were printing the addr_off instead of the sym_off. And the testcases all expected the address offset instead of the symbol table offset. * src/readelf.c (print_gdb_index_section): Print sym_off as Symbol table offset. * tests/run-readelf-gdb_index.sh: Fix up all symbol table offsets that were the same as the address offset. Signed-off-by: Mark Wielaard --- src/readelf.c | 2 +- tests/run-readelf-gdb_index.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/readelf.c b/src/readelf.c index 48035264be13..8d96443daa83 100644 --- a/src/readelf.c +++ b/src/readelf.c @@ -11699,7 +11699,7 @@ print_gdb_index_section (Dwfl_Module *dwflmod, Ebl *ebl, printf (_("\n Symbol table at offset %#" PRIx32 " contains %zu slots:\n"), - addr_off, sym_nr); + sym_off, sym_nr); n = 0; while (dataend - readp >= 8 && n < sym_nr) diff --git a/tests/run-readelf-gdb_index.sh b/tests/run-readelf-gdb_index.sh index cd437f523ec6..8efc2e805f5a 100755 --- a/tests/run-readelf-gdb_index.sh +++ b/tests/run-readelf-gdb_index.sh @@ -86,7 +86,7 @@ GDB section [33] '.gdb_index' at offset 0xe76 contains 8383 bytes : [ 0] 0x000000000040049c
..0x00000000004004d1 , CU index: 0 [ 1] 0x00000000004004d4 ..0x000000000040050b , CU index: 1 - Symbol table at offset 0x50 contains 1024 slots: + Symbol table at offset 0x78 contains 1024 slots: [ 123] symbol: global, CUs: 1 [ 489] symbol: main, CUs: 0 [ 518] symbol: char, CUs: 0 @@ -117,7 +117,7 @@ GDB section [33] '.gdb_index' at offset 0xe76 contains 8399 bytes : [ 0] 0x000000000040049c
..0x00000000004004d1 , CU index: 0 [ 1] 0x00000000004004d4 ..0x000000000040050b , CU index: 1 - Symbol table at offset 0x50 contains 1024 slots: + Symbol table at offset 0x78 contains 1024 slots: [ 123] symbol: global, CUs: 1 (var:G) [ 489] symbol: main, CUs: 0 (func:G) [ 518] symbol: char, CUs: 0 (type:S) @@ -150,7 +150,7 @@ GDB section [33] '.gdb_index' at offset 0x38e1 contains 8415 bytes : [ 0] 0x0000000000401106
..0x000000000040113b , CU index: 1 [ 1] 0x000000000040113c ..0x0000000000401173 , CU index: 2 - Symbol table at offset 0x54 contains 1024 slots: + Symbol table at offset 0x7c contains 1024 slots: [ 123] symbol: global, CUs: 1 (var:G), 0T (var:G) [ 489] symbol: main, CUs: 1 (func:G) [ 518] symbol: char, CUs: 0 (type:S) @@ -204,7 +204,7 @@ GDB section [35] '.gdb_index' at offset 0x37d9 contains 8395 bytes : Address list at offset 0x2c contains 1 entries: [ 0] 0x0000000000401166 ..0x00000000004013f0 , CU index: 0 - Symbol table at offset 0x2c contains 1024 slots: + Symbol table at offset 0x40 contains 1024 slots: [ 61] symbol: small_stride, CUs: 0 (type:S) [ 71] symbol: integer(kind=8), CUs: 0 (type:S) [ 161] symbol: character(kind=1), CUs: 0 (type:S)