[Lldb-commits] [lldb] [lldb][DWARF] Delay struct/class/union definition DIE searching when parsing declaration DIEs. (PR #90663)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri May 10 12:58:34 PDT 2024
clayborg wrote:
Ok, I found the issue. `.debug_names` tables with `DW_IDX_parent` entries, might contain tons of entries for forward declared classes because in my example `std::ios_base` is the parent declaration context for `seekdir`, `openmode`, and `iostate` so `.debug_names` entries for these types will refer to another `.debug_names` for `std::ios_base` as the parent, buit this is messing up the table itself as now it contains entries that are not all full definitions. The `.debug_names` spec states that only entries with definitions should be in the .debug_names table...
That being said, an easy fix is this:
```bool DebugNamesDWARFIndex::ProcessEntry(
const DebugNames::Entry &entry,
llvm::function_ref<bool(DWARFDIE die)> callback) {
std::optional<DIERef> ref = ToDIERef(entry);
if (!ref)
return true;
SymbolFileDWARF &dwarf = *llvm::cast<SymbolFileDWARF>(
m_module.GetSymbolFile()->GetBackingSymbolFile());
DWARFDIE die = dwarf.GetDIE(*ref);
if (!die)
return true;
// Watch out for forward declarations that appear in the .debug_names tables
// only due to being there for a DW_IDX_parent.
if (die.GetAttributeValueAsUnsigned(DW_AT_declaration, 0)) /// <<< newly added for fix
return true;/// <<< newly added for fix
return callback(die);
}
```
https://github.com/llvm/llvm-project/pull/90663
More information about the lldb-commits
mailing list