From: Greg Clayton Date: Wed, 10 Feb 2016 21:28:13 +0000 (+0000) Subject: Now that SymbolFileDWARF supports having types in completely separate .pcm file with... X-Git-Tag: llvmorg-3.9.0-rc1~14535 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae088e52f315943762023fa90be439864ac54378;p=platform%2Fupstream%2Fllvm.git Now that SymbolFileDWARF supports having types in completely separate .pcm file with "-fmodules -gmodules", each SymbolFileDWARF can reference module DWARF info by looking in other DWARF files. Then if you have 1000 .o files that each reference one or more .pcm files in their debug info, a simple Module::FindTypes(...) call can end up searching the same .pcm file over and over and over. Now all internal FindTypes methods in classes (ModuleList, Module, SymbolFile) now take an extra argument: llvm::DenseSet &searched_symbol_files Each time a SymbolFile::FindTypes() is called, it needs to check the searched_symbol_files list to make sure it hasn't already been asked to find the type and return immediately if it has been checked. This will stop circular dependencies from also crashing LLDB during type queries. This has proven to be an issue when debugging large applications on MacOSX that use DWARF in .o files. llvm-svn: 260434 --- diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 35b182a..70c10fd 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -27,6 +27,7 @@ #include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/TypeSystem.h" #include "lldb/Target/PathMappingList.h" +#include "llvm/ADT/DenseSet.h" namespace lldb_private { @@ -498,6 +499,7 @@ public: const ConstString &type_name, bool exact_match, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeList& types); lldb::TypeSP @@ -1194,6 +1196,7 @@ private: const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap& types); DISALLOW_COPY_AND_ASSIGN (Module); diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index a0dd432..49984c1 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -21,6 +21,7 @@ #include "lldb/lldb-private.h" #include "lldb/Host/Mutex.h" #include "lldb/Utility/Iterable.h" +#include "llvm/ADT/DenseSet.h" namespace lldb_private { @@ -450,6 +451,7 @@ public: const ConstString &name, bool name_is_fully_qualified, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeList& types) const; bool diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index fe74ad4..b555ecd 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -17,6 +17,8 @@ #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/Type.h" +#include "llvm/ADT/DenseSet.h" + namespace lldb_private { class SymbolFile : @@ -141,7 +143,7 @@ public: virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables); virtual uint32_t FindFunctions (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list); virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list); - virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types); + virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap& types); virtual size_t FindTypes (const std::vector &context, bool append, TypeMap& types); virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector &mangled_names); diff --git a/lldb/include/lldb/Symbol/SymbolVendor.h b/lldb/include/lldb/Symbol/SymbolVendor.h index 1946171..dbea8c9 100644 --- a/lldb/include/lldb/Symbol/SymbolVendor.h +++ b/lldb/include/lldb/Symbol/SymbolVendor.h @@ -17,6 +17,7 @@ #include "lldb/Core/PluginInterface.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/TypeMap.h" +#include "llvm/ADT/DenseSet.h" namespace lldb_private { @@ -129,6 +130,7 @@ public: const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap& types); virtual size_t diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp index a810940..bf015f7 100644 --- a/lldb/source/API/SBModule.cpp +++ b/lldb/source/API/SBModule.cpp @@ -21,6 +21,7 @@ #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/Symtab.h" #include "lldb/Symbol/TypeSystem.h" @@ -555,10 +556,12 @@ SBModule::FindTypes (const char *type) TypeList type_list; const bool exact_match = false; ConstString name(type); + llvm::DenseSet searched_symbol_files; const uint32_t num_matches = module_sp->FindTypes (sc, name, exact_match, UINT32_MAX, + searched_symbol_files, type_list); if (num_matches > 0) diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp index a3d4ccc..67c3e42 100644 --- a/lldb/source/API/SBTarget.cpp +++ b/lldb/source/API/SBTarget.cpp @@ -49,6 +49,7 @@ #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/DeclVendor.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ABI.h" @@ -1893,11 +1894,12 @@ SBTarget::FindTypes (const char* typename_cstr) bool exact_match = false; SymbolContext sc; TypeList type_list; - + llvm::DenseSet searched_symbol_files; uint32_t num_matches = images.FindTypes (sc, const_typename, exact_match, UINT32_MAX, + searched_symbol_files, type_list); if (num_matches > 0) diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index f8fe456..cfb28b2 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -35,6 +35,7 @@ #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/TypeList.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Target/MemoryHistory.h" #include "lldb/Target/Process.h" #include "lldb/Target/StackFrame.h" @@ -514,6 +515,7 @@ protected: } } + llvm::DenseSet searched_symbol_files; ConstString lookup_type_name(type_str.c_str()); StackFrame *frame = m_exe_ctx.GetFramePtr(); if (frame) @@ -524,7 +526,8 @@ protected: sc.module_sp->FindTypes (sc, lookup_type_name, exact_match, - 1, + 1, + searched_symbol_files, type_list); } } @@ -533,7 +536,8 @@ protected: target->GetImages().FindTypes (sc, lookup_type_name, exact_match, - 1, + 1, + searched_symbol_files, type_list); } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 95c03e9..4e86fd9 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1852,7 +1852,8 @@ LookupTypeInModule (CommandInterpreter &interpreter, SymbolContext sc; ConstString name(name_cstr); - num_matches = module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, type_list); + llvm::DenseSet searched_symbol_files; + num_matches = module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, searched_symbol_files, type_list); if (num_matches) { @@ -1905,7 +1906,8 @@ LookupTypeHere (CommandInterpreter &interpreter, bool name_is_fully_qualified = false; ConstString name(name_cstr); - num_matches = sym_ctx.module_sp->FindTypes(sym_ctx, name, name_is_fully_qualified, max_num_matches, type_list); + llvm::DenseSet searched_symbol_files; + num_matches = sym_ctx.module_sp->FindTypes(sym_ctx, name, name_is_fully_qualified, max_num_matches, searched_symbol_files, type_list); if (num_matches) { diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index a29456f..3ada483 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -933,6 +933,7 @@ Module::FindTypes_Impl (const SymbolContext& sc, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap& types) { Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); @@ -940,7 +941,7 @@ Module::FindTypes_Impl (const SymbolContext& sc, { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) - return symbols->FindTypes(sc, name, parent_decl_ctx, append, max_matches, types); + return symbols->FindTypes(sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); } return 0; } @@ -954,7 +955,8 @@ Module::FindTypesInNamespace (const SymbolContext& sc, { const bool append = true; TypeMap types_map; - size_t num_types = FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches, types_map); + llvm::DenseSet searched_symbol_files; + size_t num_types = FindTypes_Impl(sc, type_name, parent_decl_ctx, append, max_matches, searched_symbol_files, types_map); if (num_types > 0) sc.SortTypeList(types_map, type_list); return num_types; @@ -966,7 +968,8 @@ Module::FindFirstType (const SymbolContext& sc, bool exact_match) { TypeList type_list; - const size_t num_matches = FindTypes (sc, name, exact_match, 1, type_list); + llvm::DenseSet searched_symbol_files; + const size_t num_matches = FindTypes (sc, name, exact_match, 1, searched_symbol_files, type_list); if (num_matches) return type_list.GetTypeAtIndex(0); return TypeSP(); @@ -978,6 +981,7 @@ Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool exact_match, size_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeList& types) { size_t num_matches = 0; @@ -1000,7 +1004,7 @@ Module::FindTypes (const SymbolContext& sc, exact_match = true; } ConstString type_basename_const_str (type_basename.c_str()); - if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, typesmap)) + if (FindTypes_Impl(sc, type_basename_const_str, NULL, append, max_matches, searched_symbol_files, typesmap)) { typesmap.RemoveMismatchedTypes (type_scope, type_basename, type_class, exact_match); num_matches = typesmap.GetSize(); @@ -1013,13 +1017,13 @@ Module::FindTypes (const SymbolContext& sc, { // The "type_name_cstr" will have been modified if we have a valid type class // prefix (like "struct", "class", "union", "typedef" etc). - FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, typesmap); + FindTypes_Impl(sc, ConstString(type_name_cstr), NULL, append, max_matches, searched_symbol_files, typesmap); typesmap.RemoveMismatchedTypes (type_class); num_matches = typesmap.GetSize(); } else { - num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, typesmap); + num_matches = FindTypes_Impl(sc, name, NULL, append, max_matches, searched_symbol_files, typesmap); } } if (num_matches > 0) diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 75b2ca1..0178cf8 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -23,6 +23,7 @@ #include "lldb/Host/Host.h" #include "lldb/Host/Symbols.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/VariableList.h" using namespace lldb; @@ -654,7 +655,7 @@ ModuleList::FindModule (const UUID &uuid) const size_t -ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, TypeList& types) const +ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeList& types) const { Mutex::Locker locker(m_modules_mutex); @@ -668,7 +669,7 @@ ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool na { if (sc.module_sp.get() == (*pos).get()) { - total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, types); + total_matches += (*pos)->FindTypes (sc, name, name_is_fully_qualified, max_matches, searched_symbol_files, types); if (total_matches >= max_matches) break; @@ -685,7 +686,7 @@ ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool na // context "sc". If "sc" contains a empty module shared pointer, then // the comparison will always be true (valid_module_ptr != NULL). if (sc.module_sp.get() != (*pos).get()) - total_matches += (*pos)->FindTypes (world_sc, name, name_is_fully_qualified, max_matches, types); + total_matches += (*pos)->FindTypes (world_sc, name, name_is_fully_qualified, max_matches, searched_symbol_files, types); if (total_matches >= max_matches) break; diff --git a/lldb/source/DataFormatters/TypeFormat.cpp b/lldb/source/DataFormatters/TypeFormat.cpp index 6ab8d29..a810883 100644 --- a/lldb/source/DataFormatters/TypeFormat.cpp +++ b/lldb/source/DataFormatters/TypeFormat.cpp @@ -23,6 +23,7 @@ #include "lldb/DataFormatters/FormatManager.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/Target.h" @@ -199,7 +200,8 @@ TypeFormatImpl_EnumType::FormatObject (ValueObject *valobj, const ModuleList& images(target_sp->GetImages()); SymbolContext sc; TypeList types; - images.FindTypes(sc, m_enum_type, false, UINT32_MAX, types); + llvm::DenseSet searched_symbol_files; + images.FindTypes(sc, m_enum_type, false, UINT32_MAX, searched_symbol_files, types); if (types.GetSize() == 0) return false; for (lldb::TypeSP type_sp : types.Types()) diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp index c158de0..7d8cedf 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp @@ -20,6 +20,7 @@ #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/CompilerDeclContext.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -299,7 +300,8 @@ ClangASTSource::CompleteType (TagDecl *tag_decl) const ModuleList &module_list = m_target->GetImages(); bool exact_match = false; - module_list.FindTypes (null_sc, name, exact_match, UINT32_MAX, types); + llvm::DenseSet searched_symbol_files; + module_list.FindTypes (null_sc, name, exact_match, UINT32_MAX, searched_symbol_files, types); for (uint32_t ti = 0, te = types.GetSize(); ti != te && !found; @@ -743,11 +745,11 @@ ClangASTSource::FindExternalVisibleDecls (NameSearchContext &context, TypeList types; SymbolContext null_sc; const bool exact_match = false; - + llvm::DenseSet searched_symbol_files; if (module_sp && namespace_decl) module_sp->FindTypesInNamespace(null_sc, name, &namespace_decl, 1, types); else - m_target->GetImages().FindTypes(null_sc, name, exact_match, 1, types); + m_target->GetImages().FindTypes(null_sc, name, exact_match, 1, searched_symbol_files, types); bool found_a_type = false; diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp index 3f12a2b..0b074f8 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp +++ b/lldb/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp @@ -40,6 +40,7 @@ #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Symbol/GoASTContext.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" @@ -229,7 +230,8 @@ LookupType(TargetSP target, ConstString name) return CompilerType(); SymbolContext sc; TypeList type_list; - uint32_t num_matches = target->GetImages().FindTypes(sc, name, false, 2, type_list); + llvm::DenseSet searched_symbol_files; + uint32_t num_matches = target->GetImages().FindTypes(sc, name, false, 2, searched_symbol_files, type_list); if (num_matches > 0) { return type_list.GetTypeAtIndex(0)->GetFullCompilerType(); diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index bbe716b..983ddf36 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -20,6 +20,7 @@ #include "lldb/Core/ValueObjectMemory.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" @@ -126,12 +127,14 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, uint32_t num_matches = 0; // First look in the module that the vtable symbol came from // and look for a single exact match. + llvm::DenseSet searched_symbol_files; if (sc.module_sp) { num_matches = sc.module_sp->FindTypes (sc, ConstString(class_name), exact_match, 1, + searched_symbol_files, class_types); } @@ -144,6 +147,7 @@ ItaniumABILanguageRuntime::GetDynamicTypeAndAddress (ValueObject &in_value, ConstString(class_name), exact_match, UINT32_MAX, + searched_symbol_files, class_types); } diff --git a/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp index d59f292..c752971 100644 --- a/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp @@ -20,6 +20,7 @@ #include "lldb/Core/ValueObjectMemory.h" #include "lldb/Symbol/GoASTContext.h" #include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" @@ -117,10 +118,12 @@ LookupRuntimeType(ValueObjectSP type, ExecutionContext* exe_ctx, bool* is_direct SymbolContext sc; TypeList type_list; + llvm::DenseSet searched_symbol_files; uint32_t num_matches = target->GetImages().FindTypes (sc, const_typename, false, 2, + searched_symbol_files, type_list); if (num_matches > 0) { return type_list.GetTypeAtIndex(0)->GetFullCompilerType(); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index b238364..d09ee06 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3004,9 +3004,20 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap& types) { + // If we aren't appending the results to this list, then clear the list + if (!append) + types.Clear(); + + // Make sure we haven't already searched this SymbolFile before... + if (searched_symbol_files.count(this)) + return 0; + else + searched_symbol_files.insert(this); + DWARFDebugInfo* info = DebugInfo(); if (info == NULL) return 0; @@ -3029,10 +3040,6 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, max_matches); } - // If we aren't appending the results to this list, then clear the list - if (!append) - types.Clear(); - if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx)) return 0; @@ -3130,6 +3137,7 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc, parent_decl_ctx, append, max_matches, + searched_symbol_files, types); if (num_external_matches) return num_external_matches; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h index be09759..245354c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h @@ -218,6 +218,7 @@ public: const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, lldb_private::TypeMap& types) override; size_t diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index be25dfc..793c81c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -1276,7 +1276,8 @@ SymbolFileDWARFDebugMap::FindTypes const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + uint32_t max_matches, + llvm::DenseSet &searched_symbol_files, TypeMap& types ) { @@ -1290,12 +1291,12 @@ SymbolFileDWARFDebugMap::FindTypes { oso_dwarf = GetSymbolFile (sc); if (oso_dwarf) - return oso_dwarf->FindTypes (sc, name, parent_decl_ctx, append, max_matches, types); + return oso_dwarf->FindTypes (sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); } else { ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { - oso_dwarf->FindTypes (sc, name, parent_decl_ctx, append, max_matches, types); + oso_dwarf->FindTypes (sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); return false; }); } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index 1eb33c9..25a4e19 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -82,7 +82,7 @@ public: uint32_t FindGlobalVariables (const lldb_private::RegularExpression& regex, bool append, uint32_t max_matches, lldb_private::VariableList& variables) override; uint32_t FindFunctions (const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list) override; uint32_t FindFunctions (const lldb_private::RegularExpression& regex, bool include_inlines, bool append, lldb_private::SymbolContextList& sc_list) override; - uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, lldb_private::TypeMap& types) override; + uint32_t FindTypes (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, lldb_private::TypeMap& types) override; lldb_private::CompilerDeclContext FindNamespace (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp index 82bbceb..808dfd3 100644 --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -141,7 +141,7 @@ SymbolFile::GetMangledNamesForFunction(const std::string &scope_qualified_name, } uint32_t -SymbolFile::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, TypeMap& types) +SymbolFile::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap& types) { if (!append) types.Clear(); diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index b9ec9a1..2666851 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -358,14 +358,14 @@ SymbolVendor::FindFunctions(const RegularExpression& regex, bool include_inlines size_t -SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, TypeMap& types) +SymbolVendor::FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, llvm::DenseSet &searched_symbol_files, TypeMap& types) { ModuleSP module_sp(GetModule()); if (module_sp) { lldb_private::Mutex::Locker locker(module_sp->GetMutex()); if (m_sym_file_ap.get()) - return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append, max_matches, types); + return m_sym_file_ap->FindTypes(sc, name, parent_decl_ctx, append, max_matches, searched_symbol_files, types); } if (!append) types.Clear(); diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index a18e4c6..8911d9d 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -16,6 +16,7 @@ #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/SymbolFile.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/TypeList.h" #include "lldb/Target/ObjCLanguageRuntime.h" @@ -122,11 +123,13 @@ ObjCLanguageRuntime::LookupInCompleteClassCache (ConstString &name) const bool exact_match = true; const uint32_t max_matches = UINT32_MAX; TypeList types; - + + llvm::DenseSet searched_symbol_files; const uint32_t num_types = module_sp->FindTypes (null_sc, name, exact_match, max_matches, + searched_symbol_files, types); if (num_types)