Index: include/lldb/Core/Module.h =================================================================== --- include/lldb/Core/Module.h +++ include/lldb/Core/Module.h @@ -49,7 +49,6 @@ class SymbolContext; class SymbolContextList; class SymbolFile; -class SymbolVendor; class Symtab; class Target; class TypeList; @@ -67,8 +66,8 @@ /// accessors are called. For example the object file (ObjectFile) /// representation will only be parsed if the object file is requested using /// the Module::GetObjectFile() is called. The debug symbols will only be -/// parsed if the symbol vendor (SymbolVendor) is requested using the -/// Module::GetSymbolVendor() is called. +/// parsed if the symbol file (SymbolFile) is requested using the +/// Module::GetSymbolFile() method. /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, @@ -420,10 +419,9 @@ /// Find types by name. /// - /// Type lookups in modules go through the SymbolVendor (which will use one - /// or more SymbolFile subclasses). The SymbolFile needs to be able to - /// lookup types by basename and not the fully qualified typename. This - /// allows the type accelerator tables to stay small, even with heavily + /// Type lookups in modules go through the SymbolFile. The SymbolFile needs to + /// be able to lookup types by basename and not the fully qualified typename. + /// This allows the type accelerator tables to stay small, even with heavily /// templatized C++. The type search will then narrow down the search /// results. If "exact_match" is true, then the type search will only match /// exact type name matches. If "exact_match" is false, the type will match @@ -638,23 +636,17 @@ ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, Status &error, size_t size_to_read = 512); - /// Get the symbol vendor interface for the current architecture. - /// - /// If the symbol vendor file has not been located yet, this function will - /// find the best SymbolVendor plug-in that can use the current object file. + + /// Get the module's symbol file /// - /// \return - /// If this module does not have a valid object file, or no - /// plug-in can be found that can use the object file, nullptr will - /// be returned, else a valid symbol vendor plug-in interface - /// will be returned. The returned pointer is owned by this - /// object and remains valid as long as the object is around. - virtual SymbolVendor * - GetSymbolVendor(bool can_create = true, - lldb_private::Stream *feedback_strm = nullptr); - - SymbolFile *GetSymbolFile(bool can_create = true, - Stream *feedback_strm = nullptr); + /// If the symbol file has already been loaded, this function returns it. All + /// arguments are ignored. If the symbol file has not been located yet, and + /// the can_create argument is false, the function returns nullptr. If + /// can_create is true, this function will find the best SymbolFile plug-in + /// that can use the current object file. feedback_strm, if not null, is used + /// to report the details of the search process. + virtual SymbolFile *GetSymbolFile(bool can_create = true, + Stream *feedback_strm = nullptr); Symtab *GetSymtab(); @@ -847,7 +839,7 @@ // when the module first gets created. bool FileHasChanged() const; - // SymbolVendor, SymbolFile and ObjectFile member objects should lock the + // SymbolFile and ObjectFile member objects should lock the // module mutex to avoid deadlocks. std::recursive_mutex &GetMutex() const { return m_mutex; } @@ -899,12 +891,12 @@ /// A class that encapsulates name lookup information. /// /// Users can type a wide variety of partial names when setting breakpoints - /// by name or when looking for functions by name. SymbolVendor and - /// SymbolFile objects are only required to implement name lookup for - /// function basenames and for fully mangled names. This means if the user - /// types in a partial name, we must reduce this to a name lookup that will - /// work with all SymbolFile objects. So we might reduce a name lookup to - /// look for a basename, and then prune out any results that don't match. + /// by name or when looking for functions by name. The SymbolFile object is + /// only required to implement name lookup for function basenames and for + /// fully mangled names. This means if the user types in a partial name, we + /// must reduce this to a name lookup that will work with all SymbolFile + /// objects. So we might reduce a name lookup to look for a basename, and then + /// prune out any results that don't match. /// /// The "m_name" member variable represents the name as it was typed by the /// user. "m_lookup_name" will be the name we actually search for through @@ -1011,7 +1003,7 @@ /// ObjectFile instances for the debug info std::atomic m_did_load_objfile{false}; - std::atomic m_did_load_symbol_vendor{false}; + std::atomic m_did_load_symbol_file{false}; std::atomic m_did_set_uuid{false}; mutable bool m_file_has_changed : 1, m_first_file_changed_log : 1; /// See if the module was modified after it Index: source/Core/Module.cpp =================================================================== --- source/Core/Module.cpp +++ source/Core/Module.cpp @@ -1037,28 +1037,21 @@ return num_matches; } -SymbolVendor *Module::GetSymbolVendor(bool can_create, - lldb_private::Stream *feedback_strm) { - if (!m_did_load_symbol_vendor.load()) { +SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) { + if (!m_did_load_symbol_file.load()) { std::lock_guard guard(m_mutex); - if (!m_did_load_symbol_vendor.load() && can_create) { + if (!m_did_load_symbol_file.load() && can_create) { ObjectFile *obj_file = GetObjectFile(); if (obj_file != nullptr) { static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION); m_symfile_up.reset( SymbolVendor::FindPlugin(shared_from_this(), feedback_strm)); - m_did_load_symbol_vendor = true; + m_did_load_symbol_file = true; } } } - return m_symfile_up.get(); -} - -SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) { - if (SymbolVendor *vendor = GetSymbolVendor(can_create, feedback_strm)) - return vendor->GetSymbolFile(); - return nullptr; + return m_symfile_up ? m_symfile_up->GetSymbolFile() : nullptr; } Symtab *Module::GetSymtab() { @@ -1467,7 +1460,7 @@ } m_symfile_spec = file; m_symfile_up.reset(); - m_did_load_symbol_vendor = false; + m_did_load_symbol_file = false; } bool Module::IsExecutable() { Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -41,7 +41,7 @@ // Subclass lldb_private::Module so we can intercept the // "Module::GetObjectFile()" (so we can fixup the object file sections) and -// also for "Module::GetSymbolVendor()" (so we can fixup the symbol file id. +// also for "Module::GetSymbolFile()" (so we can fixup the symbol file id. const SymbolFileDWARFDebugMap::FileRangeMap & SymbolFileDWARFDebugMap::CompileUnitInfo::GetFileRangeMap( @@ -173,12 +173,12 @@ ~DebugMapModule() override = default; - SymbolVendor * - GetSymbolVendor(bool can_create = true, - lldb_private::Stream *feedback_strm = nullptr) override { + SymbolFile * + GetSymbolFile(bool can_create = true, + lldb_private::Stream *feedback_strm = nullptr) override { // Scope for locker if (m_symfile_up.get() || !can_create) - return m_symfile_up.get(); + return m_symfile_up ? m_symfile_up->GetSymbolFile() : nullptr; ModuleSP exe_module_sp(m_exe_module_wp.lock()); if (exe_module_sp) { @@ -186,30 +186,28 @@ ObjectFile *oso_objfile = GetObjectFile(); if (oso_objfile) { std::lock_guard guard(m_mutex); - SymbolVendor *symbol_vendor = - Module::GetSymbolVendor(can_create, feedback_strm); - if (symbol_vendor) { + if (SymbolFile *symfile = + Module::GetSymbolFile(can_create, feedback_strm)) { // Set a pointer to this class to set our OSO DWARF file know that // the DWARF is being used along with a debug map and that it will // have the remapped sections that we do below. SymbolFileDWARF *oso_symfile = - SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF( - symbol_vendor->GetSymbolFile()); + SymbolFileDWARFDebugMap::GetSymbolFileAsSymbolFileDWARF(symfile); if (!oso_symfile) return nullptr; ObjectFile *exe_objfile = exe_module_sp->GetObjectFile(); - SymbolVendor *exe_sym_vendor = exe_module_sp->GetSymbolVendor(); + SymbolFile *exe_symfile = exe_module_sp->GetSymbolFile(); - if (exe_objfile && exe_sym_vendor) { + if (exe_objfile && exe_symfile) { oso_symfile->SetDebugMapModule(exe_module_sp); // Set the ID of the symbol file DWARF to the index of the OSO // shifted left by 32 bits to provide a unique prefix for any // UserID's that get created in the symbol file. oso_symfile->SetID(((uint64_t)m_cu_idx + 1ull) << 32ull); } - return symbol_vendor; + return symfile; } } } @@ -533,12 +531,8 @@ SymbolFileDWARF *SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo( CompileUnitInfo *comp_unit_info) { - Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info); - if (oso_module) { - SymbolVendor *sym_vendor = oso_module->GetSymbolVendor(); - if (sym_vendor) - return GetSymbolFileAsSymbolFileDWARF(sym_vendor->GetSymbolFile()); - } + if (Module *oso_module = GetModuleByCompUnitInfo(comp_unit_info)) + return GetSymbolFileAsSymbolFileDWARF(oso_module->GetSymbolFile()); return nullptr; }