diff options
author | Tom Tromey <tom@tromey.com> | 2023-04-28 13:04:15 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-05-15 08:49:24 -0600 |
commit | b10f2cd3f3c3b25c71e50a342fb46f9eb9eba792 (patch) | |
tree | 03f156b3ff8198d3e44dedbb5a6d46da83c3df76 /gdb/dwarf2 | |
parent | 6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b (diff) | |
download | binutils-gdb-b10f2cd3f3c3b25c71e50a342fb46f9eb9eba792.tar.gz |
Correctly handle forward DIE references in scanner
The cooked index scanner has special code to handle forward DIE
references. However, a bug report lead to the discovery that this
code does not work -- the "deferred_entry::spec_offset" field is
written to but never used, i.e., the lookup is done using the wrong
key.
This patch fixes the bug and adds a regression test.
The test in the bug itself used a thread_local variable, which
provoked a failure at runtime. This test instead uses "maint print
objfiles" and then inspects to ensure that the entry in question has a
parent. This lets us avoid a clang dependency in the test.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30271
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/read.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index b99c5cd3a2c..4828409222c 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -16641,9 +16641,8 @@ cooked_indexer::make_index (cutu_reader *reader) for (const auto &entry : m_deferred_entries) { - CORE_ADDR key = form_addr (entry.die_offset, m_per_cu->is_dwz); - void *obj = m_die_range_map.find (key); - cooked_index_entry *parent = static_cast <cooked_index_entry *> (obj); + void *obj = m_die_range_map.find (entry.spec_offset); + cooked_index_entry *parent = static_cast<cooked_index_entry *> (obj); m_index_storage->add (entry.die_offset, entry.tag, entry.flags, entry.name, parent, m_per_cu); } |