diff options
author | Tom Tromey <tom@tromey.com> | 2024-02-09 17:40:35 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2024-02-29 17:12:58 -0700 |
commit | 932e5949a9f366d149b1b9093c49225502dee890 (patch) | |
tree | 398e742bfbb6598df11c12786bc533b970c90795 /gdb | |
parent | 3f13a7b28cb648eb374437271ca3d9bdb86a77dd (diff) | |
download | binutils-932e5949a9f366d149b1b9093c49225502dee890.zip binutils-932e5949a9f366d149b1b9093c49225502dee890.tar.gz binutils-932e5949a9f366d149b1b9093c49225502dee890.tar.bz2 |
Use DW_FORM_ref_addr for DIE offset in .debug_names
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
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/dwarf2/index-write.c | 7 | ||||
-rw-r--r-- | 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 0123e7f..a114001 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) != 0) @@ -796,7 +796,10 @@ public: 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 e2563e8..0add804 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; |