Index: lldb/trunk/include/lldb/Symbol/SymbolFile.h =================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolFile.h +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h @@ -110,8 +110,8 @@ // Compile Unit function calls // Approach 1 - iterator - virtual uint32_t GetNumCompileUnits() = 0; - virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0; + uint32_t GetNumCompileUnits(); + lldb::CompUnitSP GetCompileUnitAtIndex(uint32_t idx); virtual lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) = 0; virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0; @@ -235,12 +235,17 @@ return nullptr; } - virtual void Dump(Stream &s) {} + virtual void Dump(Stream &s); protected: void AssertModuleLock(); + virtual uint32_t CalculateNumCompileUnits() = 0; + virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t idx) = 0; + + void SetCompileUnitAtIndex(uint32_t idx, const lldb::CompUnitSP &cu_sp); ObjectFile *m_obj_file; // The object file that symbols can be extracted from. + llvm::Optional> m_compile_units; uint32_t m_abilities; bool m_calculated_abilities; Index: lldb/trunk/include/lldb/Symbol/SymbolVendor.h =================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h @@ -110,9 +110,6 @@ virtual size_t GetNumCompileUnits(); - virtual bool SetCompileUnitAtIndex(size_t cu_idx, - const lldb::CompUnitSP &cu_sp); - virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx); TypeList &GetTypeList() { return m_type_list; } @@ -142,13 +139,7 @@ uint32_t GetPluginVersion() override; protected: - // Classes that inherit from SymbolVendor can see and modify these - typedef std::vector CompileUnits; - typedef CompileUnits::iterator CompileUnitIter; - typedef CompileUnits::const_iterator CompileUnitConstIter; - TypeList m_type_list; // Uniqued types for all parsers owned by this module - CompileUnits m_compile_units; // The current compile units lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in // case it isn't the same as the module // object file (debug symbols in a separate Index: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h +++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h @@ -46,10 +46,6 @@ // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(CompileUnit &comp_unit) override { return lldb::eLanguageTypeUnknown; } @@ -196,7 +192,9 @@ }; - SymbolVendor &GetSymbolVendor(); + uint32_t CalculateNumCompileUnits() override; + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; + lldb::addr_t GetBaseFileAddress(); void ParseFileRecords(); void ParseCUData(); Index: lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ lldb/trunk/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -187,7 +187,7 @@ return CompileUnits | Functions | LineTables; } -uint32_t SymbolFileBreakpad::GetNumCompileUnits() { +uint32_t SymbolFileBreakpad::CalculateNumCompileUnits() { ParseCUData(); return m_cu_data->GetSize(); } @@ -218,7 +218,7 @@ eLanguageTypeUnknown, /*is_optimized*/ eLazyBoolNo); - GetSymbolVendor().SetCompileUnitAtIndex(index, cu_sp); + SetCompileUnitAtIndex(index, cu_sp); return cu_sp; } @@ -260,7 +260,7 @@ if (idx == UINT32_MAX) return 0; - sc.comp_unit = GetSymbolVendor().GetCompileUnitAtIndex(idx).get(); + sc.comp_unit = GetCompileUnitAtIndex(idx).get(); SymbolContextItem result = eSymbolContextCompUnit; if (resolve_scope & eSymbolContextLineEntry) { if (sc.comp_unit->GetLineTable()->FindLineEntryByAddress(so_addr, @@ -280,7 +280,7 @@ uint32_t old_size = sc_list.GetSize(); for (size_t i = 0, size = GetNumCompileUnits(); i < size; ++i) { - CompileUnit &cu = *GetSymbolVendor().GetCompileUnitAtIndex(i); + CompileUnit &cu = *GetCompileUnitAtIndex(i); cu.ResolveSymbolContext(file_spec, line, check_inlines, /*exact*/ false, resolve_scope, sc_list); } @@ -522,10 +522,6 @@ return plan_sp; } -SymbolVendor &SymbolFileBreakpad::GetSymbolVendor() { - return *m_obj_file->GetModule()->GetSymbolVendor(); -} - addr_t SymbolFileBreakpad::GetBaseFileAddress() { return m_obj_file->GetModule() ->GetObjectFile() Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -95,10 +95,6 @@ // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override; @@ -331,6 +327,10 @@ bool DeclContextMatchesThisSymbolFile( const lldb_private::CompilerDeclContext *decl_ctx); + uint32_t CalculateNumCompileUnits() override; + + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; + virtual DWARFUnit * GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -677,8 +677,7 @@ dwarf_cu.SetUserData(cu_sp.get()); - m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex( - dwarf_cu.GetID(), cu_sp); + SetCompileUnitAtIndex(dwarf_cu.GetID(), cu_sp); } } } @@ -715,7 +714,7 @@ return m_lldb_cu_to_dwarf_unit[cu_idx]; } -uint32_t SymbolFileDWARF::GetNumCompileUnits() { +uint32_t SymbolFileDWARF::CalculateNumCompileUnits() { DWARFDebugInfo *info = DebugInfo(); if (!info) return 0; @@ -3713,7 +3712,10 @@ uint32_t SymbolFileDWARF::GetPluginVersion() { return 1; } -void SymbolFileDWARF::Dump(lldb_private::Stream &s) { m_index->Dump(s); } +void SymbolFileDWARF::Dump(lldb_private::Stream &s) { + SymbolFile::Dump(s); + m_index->Dump(s); +} void SymbolFileDWARF::DumpClangAST(Stream &s) { TypeSystem *ts = GetTypeSystemForLanguage(eLanguageTypeC_plus_plus); Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -44,9 +44,6 @@ void InitializeObject() override; // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override; @@ -174,6 +171,9 @@ // Protected Member Functions void InitOSO(); + uint32_t CalculateNumCompileUnits() override; + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; + static uint32_t GetOSOIndexFromUserID(lldb::user_id_t uid) { return (uint32_t)((uid >> 32ull) - 1ull); } Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -562,7 +562,7 @@ return 0; } -uint32_t SymbolFileDWARFDebugMap::GetNumCompileUnits() { +uint32_t SymbolFileDWARFDebugMap::CalculateNumCompileUnits() { InitOSO(); return m_compile_unit_infos.size(); } @@ -585,9 +585,8 @@ eLanguageTypeUnknown, eLazyBoolCalculate); if (m_compile_unit_infos[cu_idx].compile_unit_sp) { - // Let our symbol vendor know about this compile unit - m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex( - cu_idx, m_compile_unit_infos[cu_idx].compile_unit_sp); + SetCompileUnitAtIndex(cu_idx, + m_compile_unit_infos[cu_idx].compile_unit_sp); } } } @@ -1284,8 +1283,7 @@ cu_sp.get()); } else { m_compile_unit_infos[cu_idx].compile_unit_sp = cu_sp; - m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex( - cu_idx, cu_sp); + SetCompileUnitAtIndex(cu_idx, cu_sp); } } } Index: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h @@ -68,13 +68,9 @@ // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - void ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override; - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override; @@ -157,6 +153,9 @@ void DumpClangAST(Stream &s) override; private: + uint32_t CalculateNumCompileUnits() override; + + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; size_t FindTypesByName(llvm::StringRef name, uint32_t max_matches, TypeMap &types); Index: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -329,7 +329,7 @@ m_ast = llvm::make_unique(*m_obj_file, *m_index); } -uint32_t SymbolFileNativePDB::GetNumCompileUnits() { +uint32_t SymbolFileNativePDB::CalculateNumCompileUnits() { const DbiModuleList &modules = m_index->dbi().modules(); uint32_t count = modules.getModuleCount(); if (count == 0) @@ -433,8 +433,7 @@ std::make_shared(m_obj_file->GetModule(), nullptr, fs, toOpaqueUid(cci.m_id), lang, optimized); - m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex( - cci.m_id.modi, cu_sp); + SetCompileUnitAtIndex(cci.m_id.modi, cu_sp); return cu_sp; } Index: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h +++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h @@ -48,10 +48,6 @@ // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override; @@ -173,6 +169,10 @@ }; using SecContribsMap = std::map>; + uint32_t CalculateNumCompileUnits() override; + + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; + lldb::CompUnitSP ParseCompileUnitForUID(uint32_t id, uint32_t index = UINT32_MAX); @@ -245,7 +245,6 @@ std::vector m_builtin_types; std::unique_ptr m_session_up; std::unique_ptr m_global_scope_up; - uint32_t m_cached_compile_unit_count; lldb_private::UniqueCStringMap m_func_full_names; lldb_private::UniqueCStringMap m_func_base_names; Index: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -123,8 +123,7 @@ } SymbolFilePDB::SymbolFilePDB(lldb_private::ObjectFile *object_file) - : SymbolFile(object_file), m_session_up(), m_global_scope_up(), - m_cached_compile_unit_count(0) {} + : SymbolFile(object_file), m_session_up(), m_global_scope_up() {} SymbolFilePDB::~SymbolFilePDB() {} @@ -191,33 +190,30 @@ lldbassert(m_global_scope_up.get()); } -uint32_t SymbolFilePDB::GetNumCompileUnits() { - if (m_cached_compile_unit_count == 0) { - auto compilands = m_global_scope_up->findAllChildren(); - if (!compilands) - return 0; +uint32_t SymbolFilePDB::CalculateNumCompileUnits() { + auto compilands = m_global_scope_up->findAllChildren(); + if (!compilands) + return 0; - // The linker could link *.dll (compiland language = LINK), or import - // *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be - // found as a child of the global scope (PDB executable). Usually, such - // compilands contain `thunk` symbols in which we are not interested for - // now. However we still count them in the compiland list. If we perform - // any compiland related activity, like finding symbols through - // llvm::pdb::IPDBSession methods, such compilands will all be searched - // automatically no matter whether we include them or not. - m_cached_compile_unit_count = compilands->getChildCount(); - - // The linker can inject an additional "dummy" compilation unit into the - // PDB. Ignore this special compile unit for our purposes, if it is there. - // It is always the last one. - auto last_compiland_up = - compilands->getChildAtIndex(m_cached_compile_unit_count - 1); - lldbassert(last_compiland_up.get()); - std::string name = last_compiland_up->getName(); - if (name == "* Linker *") - --m_cached_compile_unit_count; - } - return m_cached_compile_unit_count; + // The linker could link *.dll (compiland language = LINK), or import + // *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be + // found as a child of the global scope (PDB executable). Usually, such + // compilands contain `thunk` symbols in which we are not interested for + // now. However we still count them in the compiland list. If we perform + // any compiland related activity, like finding symbols through + // llvm::pdb::IPDBSession methods, such compilands will all be searched + // automatically no matter whether we include them or not. + uint32_t compile_unit_count = compilands->getChildCount(); + + // The linker can inject an additional "dummy" compilation unit into the + // PDB. Ignore this special compile unit for our purposes, if it is there. + // It is always the last one. + auto last_compiland_up = compilands->getChildAtIndex(compile_unit_count - 1); + lldbassert(last_compiland_up.get()); + std::string name = last_compiland_up->getName(); + if (name == "* Linker *") + --compile_unit_count; + return compile_unit_count; } void SymbolFilePDB::GetCompileUnitIndex( @@ -1698,8 +1694,7 @@ if (index == UINT32_MAX) GetCompileUnitIndex(*compiland_up, index); lldbassert(index != UINT32_MAX); - m_obj_file->GetModule()->GetSymbolVendor()->SetCompileUnitAtIndex(index, - cu_sp); + SetCompileUnitAtIndex(index, cu_sp); return cu_sp; } Index: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h @@ -37,10 +37,6 @@ uint32_t CalculateAbilities() override; // Compile Unit function calls - uint32_t GetNumCompileUnits() override; - - lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; - lldb::LanguageType ParseLanguage(lldb_private::CompileUnit &comp_unit) override; @@ -85,6 +81,10 @@ uint32_t GetPluginVersion() override; protected: + uint32_t CalculateNumCompileUnits() override; + + lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override; + typedef std::map TypeMap; lldb_private::Symtab::IndexCollection m_source_indexes; Index: lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp =================================================================== --- lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ lldb/trunk/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -104,7 +104,7 @@ return abilities; } -uint32_t SymbolFileSymtab::GetNumCompileUnits() { +uint32_t SymbolFileSymtab::CalculateNumCompileUnits() { // If we don't have any source file symbols we will just have one compile // unit for the entire object file if (m_source_indexes.empty()) Index: lldb/trunk/source/Symbol/SymbolFile.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolFile.cpp +++ lldb/trunk/source/Symbol/SymbolFile.cpp @@ -10,6 +10,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/TypeMap.h" #include "lldb/Symbol/TypeSystem.h" @@ -21,6 +22,7 @@ #include using namespace lldb_private; +using namespace lldb; void SymbolFile::PreloadSymbols() { // No-op for most implementations. @@ -169,4 +171,50 @@ #endif } +uint32_t SymbolFile::GetNumCompileUnits() { + std::lock_guard guard(GetModuleMutex()); + if (!m_compile_units) { + // Create an array of compile unit shared pointers -- which will each + // remain NULL until someone asks for the actual compile unit information. + m_compile_units.emplace(CalculateNumCompileUnits()); + } + return m_compile_units->size(); +} + +CompUnitSP SymbolFile::GetCompileUnitAtIndex(uint32_t idx) { + uint32_t num = GetNumCompileUnits(); + if (idx >= num) + return nullptr; + lldb::CompUnitSP &cu_sp = (*m_compile_units)[idx]; + if (!cu_sp) + cu_sp = ParseCompileUnitAtIndex(idx); + return cu_sp; +} + +void SymbolFile::SetCompileUnitAtIndex(uint32_t idx, const CompUnitSP &cu_sp) { + std::lock_guard guard(GetModuleMutex()); + const size_t num_compile_units = GetNumCompileUnits(); + assert(idx < num_compile_units); + + // Fire off an assertion if this compile unit already exists for now. The + // partial parsing should take care of only setting the compile unit + // once, so if this assertion fails, we need to make sure that we don't + // have a race condition, or have a second parse of the same compile + // unit. + assert((*m_compile_units)[idx] == nullptr); + (*m_compile_units)[idx] = cu_sp; +} + +void SymbolFile::Dump(Stream &s) { + s.PutCString("Compile units:\n"); + if (m_compile_units) { + for (const CompUnitSP &cu_sp : *m_compile_units) { + // We currently only dump the compile units that have been parsed + if (cu_sp) + cu_sp->Dump(&s, /*show_context*/ false); + } + } + s.PutChar('\n'); +} + SymbolFile::RegisterInfoResolver::~RegisterInfoResolver() = default; Index: lldb/trunk/source/Symbol/SymbolVendor.cpp =================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp +++ lldb/trunk/source/Symbol/SymbolVendor.cpp @@ -58,8 +58,7 @@ // SymbolVendor constructor SymbolVendor::SymbolVendor(const lldb::ModuleSP &module_sp) - : ModuleChild(module_sp), m_type_list(), m_compile_units(), m_sym_file_up(), - m_symtab() {} + : ModuleChild(module_sp), m_type_list(), m_sym_file_up(), m_symtab() {} // Destructor SymbolVendor::~SymbolVendor() {} @@ -76,44 +75,14 @@ } } -bool SymbolVendor::SetCompileUnitAtIndex(size_t idx, const CompUnitSP &cu_sp) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard guard(module_sp->GetMutex()); - const size_t num_compile_units = GetNumCompileUnits(); - if (idx < num_compile_units) { - // Fire off an assertion if this compile unit already exists for now. The - // partial parsing should take care of only setting the compile unit - // once, so if this assertion fails, we need to make sure that we don't - // have a race condition, or have a second parse of the same compile - // unit. - assert(m_compile_units[idx].get() == nullptr); - m_compile_units[idx] = cu_sp; - return true; - } else { - // This should NOT happen, and if it does, we want to crash and know - // about it - assert(idx < num_compile_units); - } - } - return false; -} - size_t SymbolVendor::GetNumCompileUnits() { ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - if (m_compile_units.empty()) { - if (m_sym_file_up) { - // Resize our array of compile unit shared pointers -- which will each - // remain NULL until someone asks for the actual compile unit - // information. When this happens, the symbol file will be asked to - // parse this compile unit information. - m_compile_units.resize(m_sym_file_up->GetNumCompileUnits()); - } - } + if (m_sym_file_up) + return m_sym_file_up->GetNumCompileUnits(); } - return m_compile_units.size(); + return 0; } lldb::LanguageType SymbolVendor::ParseLanguage(CompileUnit &comp_unit) { @@ -390,14 +359,6 @@ s->IndentMore(); m_type_list.Dump(s, show_context); - CompileUnitConstIter cu_pos, cu_end; - cu_end = m_compile_units.end(); - for (cu_pos = m_compile_units.begin(); cu_pos != cu_end; ++cu_pos) { - // We currently only dump the compile units that have been parsed - if (*cu_pos) - (*cu_pos)->Dump(s, show_context); - } - if (Symtab *symtab = GetSymtab()) symtab->Dump(s, nullptr, eSortOrderNone); @@ -406,20 +367,13 @@ } CompUnitSP SymbolVendor::GetCompileUnitAtIndex(size_t idx) { - CompUnitSP cu_sp; ModuleSP module_sp(GetModule()); if (module_sp) { std::lock_guard guard(module_sp->GetMutex()); - const size_t num_compile_units = GetNumCompileUnits(); - if (idx < num_compile_units) { - cu_sp = m_compile_units[idx]; - if (cu_sp.get() == nullptr) { - m_compile_units[idx] = m_sym_file_up->ParseCompileUnitAtIndex(idx); - cu_sp = m_compile_units[idx]; - } - } + if (m_sym_file_up) + return m_sym_file_up->GetCompileUnitAtIndex(idx); } - return cu_sp; + return nullptr; } FileSpec SymbolVendor::GetMainFileSpec() const { Index: lldb/trunk/tools/lldb-test/lldb-test.cpp =================================================================== --- lldb/trunk/tools/lldb-test/lldb-test.cpp +++ lldb/trunk/tools/lldb-test/lldb-test.cpp @@ -558,7 +558,7 @@ outs() << "Found " << comp_units_count << " compile units.\n"; for (uint32_t i = 0; i < comp_units_count; i++) { - lldb::CompUnitSP comp_unit = symfile->ParseCompileUnitAtIndex(i); + lldb::CompUnitSP comp_unit = symfile->GetCompileUnitAtIndex(i); if (!comp_unit) return make_string_error("Connot parse compile unit {0}.", i);