public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names
@ 2024-02-10  0:42 Tom Tromey
  2024-02-12 17:19 ` Alexandra Petlanova Hajkova
  2024-02-29 23:38 ` Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2024-02-10  0:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31361
---
 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 @@ class debug_names
 		   : 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) != 0)
@@ -796,7 +796,10 @@ class debug_names
 	    gdb_assert (it != m_cu_index_htab.cend ());
 	    m_entry_pool.append_unsigned_leb128 (it->second);
 
-	    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 ());
 
 	    if (parent != 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 = read_unsigned_leb128 (abfd, entry, &bytes_read);
 	  entry += bytes_read;
 	  break;
+	case DW_FORM_ref_addr:
+	  ull = read_offset (abfd, entry, offset_size);
+	  entry += offset_size;
+	  break;
 	case DW_FORM_ref4:
 	  ull = read_4_bytes (abfd, entry);
 	  entry += 4;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names
  2024-02-10  0:42 [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names Tom Tromey
@ 2024-02-12 17:19 ` Alexandra Petlanova Hajkova
  2024-02-29 23:38 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandra Petlanova Hajkova @ 2024-02-12 17:19 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 412 bytes --]

On Sat, Feb 10, 2024 at 1:43 AM Tom Tromey <tom@tromey.com> wrote:

> 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.
>
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31361
>
> I can confirm this change does not introduce any regressions for ppc64le,
Fedora Rawhide

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names
  2024-02-10  0:42 [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names Tom Tromey
  2024-02-12 17:19 ` Alexandra Petlanova Hajkova
@ 2024-02-29 23:38 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2024-02-29 23:38 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> Today I realized that while the .debug_names writer uses DW_FORM_udata
Tom> for the DIE offset, DW_FORM_ref_addr would be more appropriate here.
Tom> This patch makes this change.

Tom> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31361

I'm checking this in.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-29 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-10  0:42 [PATCH] Use DW_FORM_ref_addr for DIE offset in .debug_names Tom Tromey
2024-02-12 17:19 ` Alexandra Petlanova Hajkova
2024-02-29 23:38 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).