From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5867D3858D34; Fri, 1 Mar 2024 00:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5867D3858D34 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1709252092; bh=3S/RWIPdu6hHDSyzHxZChPnXxQQZl66YpV25OZUbK7w=; h=From:To:Subject:Date:From; b=gZJkJNfDm693kQPmMwSziFVYgXpOhZ3kHHMERjrKnTpcpuUIFbSwYUPUznCyfm7l+ oBz9zskuRQ27kp8+6ET8SjORlnjv6dFmqe/PG+xwbv0oEqrTJhN+VyH6HFVf1VxI// 3dplKndxyfD0feBI5AiNl+DSaYfG5Hblw2V7glU0= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Use DW_FORM_ref_addr for DIE offset in .debug_names X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 3f13a7b28cb648eb374437271ca3d9bdb86a77dd X-Git-Newrev: 932e5949a9f366d149b1b9093c49225502dee890 Message-Id: <20240301001452.5867D3858D34@sourceware.org> Date: Fri, 1 Mar 2024 00:14:52 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D932e5949a9f3= 66d149b1b9093c49225502dee890 commit 932e5949a9f366d149b1b9093c49225502dee890 Author: Tom Tromey Date: Fri Feb 9 17:40:35 2024 -0700 Use DW_FORM_ref_addr for DIE offset in .debug_names =20 Today I realized that while the .debug_names writer uses DW_FORM_udata for the DIE offset, DW_FORM_ref_addr would be more appropriate here. This patch makes this change. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31361 Diff: --- gdb/dwarf2/index-write.c | 7 +++++-- gdb/dwarf2/read-debug-names.c | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index 0123e7f2435..a114001f4ee 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -761,7 +761,7 @@ public: : DW_IDX_type_unit); m_abbrev_table.append_unsigned_leb128 (DW_FORM_udata); m_abbrev_table.append_unsigned_leb128 (DW_IDX_die_offset); - m_abbrev_table.append_unsigned_leb128 (DW_FORM_udata); + m_abbrev_table.append_unsigned_leb128 (DW_FORM_ref_addr); m_abbrev_table.append_unsigned_leb128 (DW_IDX_GNU_language); m_abbrev_table.append_unsigned_leb128 (DW_FORM_udata); if ((entry->flags & IS_STATIC) !=3D 0) @@ -796,7 +796,10 @@ public: gdb_assert (it !=3D m_cu_index_htab.cend ()); m_entry_pool.append_unsigned_leb128 (it->second); =20 - m_entry_pool.append_unsigned_leb128 (to_underlying (entry->die_offset= )); + m_entry_pool.append_uint (dwarf5_offset_size (), + m_dwarf5_byte_order, + to_underlying (entry->die_offset)); + m_entry_pool.append_unsigned_leb128 (entry->per_cu->dw_lang ()); =20 if (parent !=3D nullptr) diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index e2563e84fcf..0add8040894 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -155,6 +155,10 @@ mapped_debug_names_reader::scan_one_entry (const char = *name, ull =3D read_unsigned_leb128 (abfd, entry, &bytes_read); entry +=3D bytes_read; break; + case DW_FORM_ref_addr: + ull =3D read_offset (abfd, entry, offset_size); + entry +=3D offset_size; + break; case DW_FORM_ref4: ull =3D read_4_bytes (abfd, entry); entry +=3D 4;