Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -634,14 +634,23 @@ DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(), m_is_dwarf64); - IndexPrivate(this, cu_language, fixed_form_sizes, GetOffset(), func_basenames, + dw_offset_t cu_offset = DW_INVALID_OFFSET; + // m_dwarf2Data->GetBaseCompileUnit() will return non null + // if m_dwarf2Data represents a DWO or DWP file. + // In this case the offset of the base compile unit should be used. + if (const DWARFCompileUnit *base_cu = m_dwarf2Data->GetBaseCompileUnit()) + cu_offset = base_cu->GetOffset(); + else + cu_offset = GetOffset(); + + IndexPrivate(this, cu_language, fixed_form_sizes, cu_offset, func_basenames, func_fullnames, func_methods, func_selectors, objc_class_selectors, globals, types, namespaces); SymbolFileDWARFDwo *dwo_symbol_file = GetDwoSymbolFile(); if (dwo_symbol_file) { IndexPrivate(dwo_symbol_file->GetCompileUnit(), cu_language, - fixed_form_sizes, GetOffset(), func_basenames, func_fullnames, + fixed_form_sizes, cu_offset, func_basenames, func_fullnames, func_methods, func_selectors, objc_class_selectors, globals, types, namespaces); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -299,6 +299,11 @@ GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, const DWARFDebugInfoEntry &cu_die); + // For regular SymbolFileDWARF instances the method returns nullptr, + // for the instances of the subclass SymbolFileDWARFDwo + // the method returns a pointer to the base compile unit. + virtual DWARFCompileUnit* GetBaseCompileUnit(); + protected: typedef llvm::DenseMap DIEToTypePtr; Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -209,6 +209,10 @@ return nullptr; } +DWARFCompileUnit* SymbolFileDWARF::GetBaseCompileUnit() { + return nullptr; +} + void SymbolFileDWARF::Initialize() { LogChannelDWARF::Initialize(); PluginManager::RegisterPlugin(GetPluginNameStatic(), Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h @@ -45,6 +45,10 @@ return nullptr; } + DWARFCompileUnit* GetBaseCompileUnit() override { + return m_base_dwarf_cu; + } + protected: void LoadSectionData(lldb::SectionType sect_type, lldb_private::DWARFDataExtractor &data) override;