Author: gclayton Date: Wed Feb 10 15:28:13 2016 New Revision: 260434 URL: http://llvm.org/viewvc/llvm-project?rev=260434&view=rev Log: 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<lldb_private::SymbolFile *> &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. <rdar://problem/24581488> Modified: lldb/trunk/include/lldb/Core/Module.h lldb/trunk/include/lldb/Core/ModuleList.h lldb/trunk/include/lldb/Symbol/SymbolFile.h lldb/trunk/include/lldb/Symbol/SymbolVendor.h lldb/trunk/source/API/SBModule.cpp lldb/trunk/source/API/SBTarget.cpp lldb/trunk/source/Commands/CommandObjectMemory.cpp lldb/trunk/source/Commands/CommandObjectTarget.cpp lldb/trunk/source/Core/Module.cpp lldb/trunk/source/Core/ModuleList.cpp lldb/trunk/source/DataFormatters/TypeFormat.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h lldb/trunk/source/Symbol/SymbolFile.cpp lldb/trunk/source/Symbol/SymbolVendor.cpp lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Modified: lldb/trunk/include/lldb/Core/Module.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/Module.h (original) +++ lldb/trunk/include/lldb/Core/Module.h Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> &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<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types); DISALLOW_COPY_AND_ASSIGN (Module); Modified: lldb/trunk/include/lldb/Core/ModuleList.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ModuleList.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/ModuleList.h (original) +++ lldb/trunk/include/lldb/Core/ModuleList.h Wed Feb 10 15:28:13 2016 @@ -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<SymbolFile *> &searched_symbol_files, TypeList& types) const; bool Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types); virtual size_t FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types); virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector<ConstString> &mangled_names); Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original) +++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types); virtual size_t Modified: lldb/trunk/source/API/SBModule.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/API/SBModule.cpp (original) +++ lldb/trunk/source/API/SBModule.cpp Wed Feb 10 15:28:13 2016 @@ -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<SymbolFile *> 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) Modified: lldb/trunk/source/API/SBTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/API/SBTarget.cpp (original) +++ lldb/trunk/source/API/SBTarget.cpp Wed Feb 10 15:28:13 2016 @@ -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* typenam bool exact_match = false; SymbolContext sc; TypeList type_list; - + llvm::DenseSet<SymbolFile *> 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) Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> 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); } Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Wed Feb 10 15:28:13 2016 @@ -1852,7 +1852,8 @@ LookupTypeInModule (CommandInterpreter & SymbolContext sc; ConstString name(name_cstr); - num_matches = module->FindTypes(sc, name, name_is_fully_qualified, max_num_matches, type_list); + llvm::DenseSet<lldb_private::SymbolFile *> 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 &inte 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<SymbolFile *> 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) { Modified: lldb/trunk/source/Core/Module.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Core/Module.cpp (original) +++ lldb/trunk/source/Core/Module.cpp Wed Feb 10 15:28:13 2016 @@ -933,6 +933,7 @@ Module::FindTypes_Impl (const SymbolCont const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types) { Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); @@ -940,7 +941,7 @@ Module::FindTypes_Impl (const SymbolCont { 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 Symb { 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<lldb_private::SymbolFile *> 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 SymbolConte bool exact_match) { TypeList type_list; - const size_t num_matches = FindTypes (sc, name, exact_match, 1, type_list); + llvm::DenseSet<lldb_private::SymbolFile *> 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& const ConstString &name, bool exact_match, size_t max_matches, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeList& types) { size_t num_matches = 0; @@ -1000,7 +1004,7 @@ Module::FindTypes (const SymbolContext& 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& { // 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) Modified: lldb/trunk/source/Core/ModuleList.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ModuleList.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Core/ModuleList.cpp (original) +++ lldb/trunk/source/Core/ModuleList.cpp Wed Feb 10 15:28:13 2016 @@ -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 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<SymbolFile *> &searched_symbol_files, TypeList& types) const { Mutex::Locker locker(m_modules_mutex); @@ -668,7 +669,7 @@ ModuleList::FindTypes (const SymbolConte { 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 SymbolConte // 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; Modified: lldb/trunk/source/DataFormatters/TypeFormat.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/TypeFormat.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/DataFormatters/TypeFormat.cpp (original) +++ lldb/trunk/source/DataFormatters/TypeFormat.cpp Wed Feb 10 15:28:13 2016 @@ -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 (V const ModuleList& images(target_sp->GetImages()); SymbolContext sc; TypeList types; - images.FindTypes(sc, m_enum_type, false, UINT32_MAX, types); + llvm::DenseSet<lldb_private::SymbolFile *> 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()) Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Wed Feb 10 15:28:13 2016 @@ -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 *t const ModuleList &module_list = m_target->GetImages(); bool exact_match = false; - module_list.FindTypes (null_sc, name, exact_match, UINT32_MAX, types); + llvm::DenseSet<SymbolFile *> 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 TypeList types; SymbolContext null_sc; const bool exact_match = false; - + llvm::DenseSet<lldb_private::SymbolFile *> 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; Modified: lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Go/GoUserExpression.cpp Wed Feb 10 15:28:13 2016 @@ -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 return CompilerType(); SymbolContext sc; TypeList type_list; - uint32_t num_matches = target->GetImages().FindTypes(sc, name, false, 2, type_list); + llvm::DenseSet<SymbolFile *> 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(); Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Wed Feb 10 15:28:13 2016 @@ -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::GetDynamicTyp 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<SymbolFile *> 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::GetDynamicTyp ConstString(class_name), exact_match, UINT32_MAX, + searched_symbol_files, class_types); } Modified: lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/Go/GoLanguageRuntime.cpp Wed Feb 10 15:28:13 2016 @@ -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, Ex SymbolContext sc; TypeList type_list; + llvm::DenseSet<SymbolFile *> 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(); Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Feb 10 15:28:13 2016 @@ -3004,9 +3004,20 @@ SymbolFileDWARF::FindTypes (const Symbol const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, - uint32_t max_matches, + uint32_t max_matches, + llvm::DenseSet<lldb_private::SymbolFile *> &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 Symbol 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 Symbol parent_decl_ctx, append, max_matches, + searched_symbol_files, types); if (num_external_matches) return num_external_matches; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Feb 10 15:28:13 2016 @@ -218,6 +218,7 @@ public: const lldb_private::CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, lldb_private::TypeMap& types) override; size_t Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> &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; }); } Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Wed Feb 10 15:28:13 2016 @@ -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<lldb_private::SymbolFile *> &searched_symbol_files, lldb_private::TypeMap& types) override; lldb_private::CompilerDeclContext FindNamespace (const lldb_private::SymbolContext& sc, const lldb_private::ConstString &name, Modified: lldb/trunk/source/Symbol/SymbolFile.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolFile.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolFile.cpp (original) +++ lldb/trunk/source/Symbol/SymbolFile.cpp Wed Feb 10 15:28:13 2016 @@ -141,7 +141,7 @@ SymbolFile::GetMangledNamesForFunction(c } 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<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types) { if (!append) types.Clear(); Modified: lldb/trunk/source/Symbol/SymbolVendor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolVendor.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Symbol/SymbolVendor.cpp (original) +++ lldb/trunk/source/Symbol/SymbolVendor.cpp Wed Feb 10 15:28:13 2016 @@ -358,14 +358,14 @@ SymbolVendor::FindFunctions(const Regula 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<lldb_private::SymbolFile *> &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(); Modified: lldb/trunk/source/Target/ObjCLanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ObjCLanguageRuntime.cpp?rev=260434&r1=260433&r2=260434&view=diff ============================================================================== --- lldb/trunk/source/Target/ObjCLanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/ObjCLanguageRuntime.cpp Wed Feb 10 15:28:13 2016 @@ -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::LookupInCompleteCla const bool exact_match = true; const uint32_t max_matches = UINT32_MAX; TypeList types; - + + llvm::DenseSet<SymbolFile *> 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) _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits