diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h @@ -24,8 +24,8 @@ DWARFCompileUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, const DWARFUnitHeader &header, const DWARFAbbreviationDeclarationSet &abbrevs, - DIERef::Section section) - : DWARFUnit(dwarf, uid, header, abbrevs, section) {} + DIERef::Section section, bool is_dwo) + : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {} DISALLOW_COPY_AND_ASSIGN(DWARFCompileUnit); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h @@ -41,8 +41,6 @@ SectionData m_data_debug_str_offsets; SectionData m_data_debug_types; - bool isDwo() { return m_dwo_section_list != nullptr; } - const DWARFDataExtractor & LoadOrGetSection(lldb::SectionType main_section_type, llvm::Optional dwo_section_type, @@ -67,6 +65,8 @@ const DWARFDataExtractor &getOrLoadStrOffsetsData(); const DWARFDataExtractor &getOrLoadDebugTypesData(); + bool isDwo() { return m_dwo_section_list != nullptr; } + llvm::DWARFContext &GetAsLLVM(); }; } // namespace lldb_private diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFTypeUnit.h @@ -28,8 +28,8 @@ DWARFTypeUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, const DWARFUnitHeader &header, const DWARFAbbreviationDeclarationSet &abbrevs, - DIERef::Section section) - : DWARFUnit(dwarf, uid, header, abbrevs, section) {} + DIERef::Section section, bool is_dwo) + : DWARFUnit(dwarf, uid, header, abbrevs, section, is_dwo) {} friend class DWARFUnit; }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -247,7 +247,7 @@ DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, const DWARFUnitHeader &header, const DWARFAbbreviationDeclarationSet &abbrevs, - DIERef::Section section); + DIERef::Section section, bool is_dwo); llvm::Error ExtractHeader(SymbolFileDWARF &dwarf, const lldb_private::DWARFDataExtractor &data, @@ -314,6 +314,7 @@ llvm::Optional m_loclist_table_header; const DIERef::Section m_section; + bool m_is_dwo; private: void ParseProducerInfo(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -32,9 +32,9 @@ DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid, const DWARFUnitHeader &header, const DWARFAbbreviationDeclarationSet &abbrevs, - DIERef::Section section) + DIERef::Section section, bool is_dwo) : UserID(uid), m_dwarf(dwarf), m_header(header), m_abbrevs(&abbrevs), - m_cancel_scopes(false), m_section(section) {} + m_cancel_scopes(false), m_section(section), m_is_dwo(is_dwo) {} DWARFUnit::~DWARFUnit() = default; @@ -336,6 +336,9 @@ } } + if (m_is_dwo) + return; + std::unique_ptr dwo_symbol_file = m_dwarf.GetDwoSymbolFileForCompileUnit(*this, cu_die); if (!dwo_symbol_file) @@ -872,11 +875,12 @@ return llvm::make_error( "No abbrev exists at the specified offset."); + bool is_dwo = dwarf.GetDWARFContext().isDwo(); if (expected_header->IsTypeUnit()) - return DWARFUnitSP( - new DWARFTypeUnit(dwarf, uid, *expected_header, *abbrevs, section)); - return DWARFUnitSP( - new DWARFCompileUnit(dwarf, uid, *expected_header, *abbrevs, section)); + return DWARFUnitSP(new DWARFTypeUnit(dwarf, uid, *expected_header, *abbrevs, + section, is_dwo)); + return DWARFUnitSP(new DWARFCompileUnit(dwarf, uid, *expected_header, + *abbrevs, section, is_dwo)); } const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -287,7 +287,7 @@ lldb::user_id_t GetUID(DIERef ref); - virtual std::unique_ptr + std::unique_ptr GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -47,12 +47,6 @@ DWARFDIE GetDIE(const DIERef &die_ref) override; - std::unique_ptr - GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu, - const DWARFDebugInfoEntry &cu_die) override { - return nullptr; - } - DWARFCompileUnit *GetBaseCompileUnit() override { return &m_base_dwarf_cu; } llvm::Optional GetDwoNum() override { return GetID() >> 32; }