[Lldb-commits] [PATCH] D61783: [DWARF] Use sequential integers for the IDs of the SymbolFileDWOs
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 10 05:58:01 PDT 2019
labath created this revision.
labath added reviewers: JDevlieghere, clayborg, aprantl.
Herald added subscribers: dexonsmith, mehdi_amini.
Instead of using the offset of the contained compile unit, we use it's
ID. The goal of this change is two-fold:
- free up space in the user_id_t representation to enable storing the debug-info-carrying section (debug_types/debug_info) without decreasing the amount of debug info we can address (as would be the case with D61503 <https://reviews.llvm.org/D61503>).
- be a step towards supporting DWO files containing more than one unit (important for debug_types+dwo, but can also happen with regular dwo+lto). For this part to fully work we'd still need to add a way to lookup the SymbolFileDWO without going through GetCompileUnitAtIndex, but making sure things don't accidentally work because the SymbolFile ID is the same as compile unit offset is a step towards that.
https://reviews.llvm.org/D61783
Files:
source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -23,7 +23,7 @@
DWARFUnit *dwarf_cu)
: SymbolFileDWARF(objfile.get()), m_obj_file_sp(objfile),
m_base_dwarf_cu(dwarf_cu) {
- SetID(((lldb::user_id_t)dwarf_cu->GetOffset()) << 32);
+ SetID(((lldb::user_id_t)dwarf_cu->GetID()) << 32);
}
void SymbolFileDWARFDwo::LoadSectionData(lldb::SectionType sect_type,
@@ -158,6 +158,7 @@
DWARFDIE
SymbolFileDWARFDwo::GetDIE(const DIERef &die_ref) {
- lldbassert(m_base_dwarf_cu->GetOffset() == die_ref.cu_offset);
+ lldbassert(die_ref.cu_offset == m_base_dwarf_cu->GetOffset() ||
+ die_ref.cu_offset == DW_INVALID_OFFSET);
return DebugInfo()->GetDIEForDIEOffset(die_ref.die_offset);
}
Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1259,7 +1259,20 @@
debug_map->GetOSOIndexFromUserID(uid));
return {dwarf, {DW_INVALID_OFFSET, dw_offset_t(uid)}};
}
- return {this, {dw_offset_t(uid >> 32), dw_offset_t(uid)}};
+ uint32_t dwarf_id = uid >> 32;
+ dw_offset_t die_offset = uid;
+
+ if (die_offset == DW_INVALID_OFFSET)
+ return {nullptr, DIERef()};
+
+ SymbolFileDWARF *dwarf = this;
+ if (DebugInfo()) {
+ if (DWARFUnit *unit = DebugInfo()->GetCompileUnitAtIndex(dwarf_id)) {
+ if (unit->GetDwoSymbolFile())
+ dwarf = unit->GetDwoSymbolFile();
+ }
+ }
+ return {dwarf, {DW_INVALID_OFFSET, die_offset}};
}
DWARFDIE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61783.199007.patch
Type: text/x-patch
Size: 1824 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190510/8978c895/attachment.bin>
More information about the lldb-commits
mailing list