diff options
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp')
| -rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index cb8ab15ea14..e2ddcfc5d64 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1199,6 +1199,15 @@ void SymbolFileDWARF::ParseDeclsForContext(CompilerDeclContext decl_ctx) { ast_parser->GetDeclForUIDFromDWARF(decl); } +user_id_t SymbolFileDWARF::GetUID(DIERef ref) { + if (GetDebugMapSymfile()) + return GetID() | ref.die_offset(); + + return user_id_t(GetDwoNum().getValueOr(0x7fffffff)) << 32 | + ref.die_offset() | + (lldb::user_id_t(ref.section() == DIERef::Section::DebugTypes) << 63); +} + llvm::Optional<SymbolFileDWARF::DecodedUID> SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) { // This method can be called without going through the symbol vendor so we @@ -1215,25 +1224,20 @@ SymbolFileDWARF::DecodeUID(lldb::user_id_t uid) { SymbolFileDWARF *dwarf = debug_map->GetSymbolFileByOSOIndex( debug_map->GetOSOIndexFromUserID(uid)); return DecodedUID{ - *dwarf, - {DIERef::Section::DebugInfo, DW_INVALID_OFFSET, dw_offset_t(uid)}}; + *dwarf, {llvm::None, DIERef::Section::DebugInfo, dw_offset_t(uid)}}; } - DIERef::Section section = - uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo; - uint32_t dwarf_id = uid >> 32 & 0x7fffffff; dw_offset_t die_offset = uid; - if (die_offset == DW_INVALID_OFFSET) return llvm::None; - SymbolFileDWARF *dwarf = this; - if (DebugInfo()) { - if (DWARFUnit *unit = DebugInfo()->GetUnitAtIndex(dwarf_id)) { - if (unit->GetDwoSymbolFile()) - dwarf = unit->GetDwoSymbolFile(); - } - } - return DecodedUID{*dwarf, {section, DW_INVALID_OFFSET, die_offset}}; + DIERef::Section section = + uid >> 63 ? DIERef::Section::DebugTypes : DIERef::Section::DebugInfo; + + llvm::Optional<uint32_t> dwo_num = uid >> 32 & 0x7fffffff; + if (*dwo_num == 0x7fffffff) + dwo_num = llvm::None; + + return DecodedUID{*this, {dwo_num, section, die_offset}}; } DWARFDIE @@ -1493,6 +1497,14 @@ lldb::ModuleSP SymbolFileDWARF::GetDWOModule(ConstString name) { DWARFDIE SymbolFileDWARF::GetDIE(const DIERef &die_ref) { + if (die_ref.dwo_num()) { + return DebugInfo() + ->GetUnitAtIndex(*die_ref.dwo_num()) + ->GetDwoSymbolFile() + ->GetDIE(die_ref); + } + + DWARFDebugInfo *debug_info = DebugInfo(); if (debug_info) return debug_info->GetDIE(die_ref); @@ -2235,10 +2247,6 @@ uint32_t SymbolFileDWARF::FindFunctions( const uint32_t original_size = sc_list.GetSize(); - DWARFDebugInfo *info = DebugInfo(); - if (info == nullptr) - return 0; - llvm::DenseSet<const DWARFDebugInfoEntry *> resolved_dies; DIEArray offsets; CompilerDeclContext empty_decl_ctx; @@ -2246,7 +2254,7 @@ uint32_t SymbolFileDWARF::FindFunctions( parent_decl_ctx = &empty_decl_ctx; std::vector<DWARFDIE> dies; - m_index->GetFunctions(name, *info, *parent_decl_ctx, name_type_mask, dies); + m_index->GetFunctions(name, *this, *parent_decl_ctx, name_type_mask, dies); for (const DWARFDIE &die: dies) { if (resolved_dies.insert(die.GetDIE()).second) ResolveFunction(die, include_inlines, sc_list); @@ -3081,7 +3089,8 @@ size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) { sc.comp_unit->SetVariableList(variables); DIEArray die_offsets; - m_index->GetGlobalVariables(*dwarf_cu, die_offsets); + m_index->GetGlobalVariables(dwarf_cu->GetNonSkeletonUnit(), + die_offsets); const size_t num_matches = die_offsets.size(); if (num_matches) { for (size_t i = 0; i < num_matches; ++i) { |

