diff options
Diffstat (limited to 'lldb')
8 files changed, 126 insertions, 160 deletions
diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 42a5e85cb30..ec1a5bc568b 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -228,6 +228,7 @@ size_t SymbolFileBreakpad::ParseFunctions(CompileUnit &comp_unit) { } bool SymbolFileBreakpad::ParseLineTable(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data; if (!data.line_table_up) @@ -239,6 +240,7 @@ bool SymbolFileBreakpad::ParseLineTable(CompileUnit &comp_unit) { bool SymbolFileBreakpad::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); CompUnitData &data = m_cu_data->GetEntryRef(comp_unit.GetID()).data; if (!data.support_files) ParseLineTableAndSupportFiles(comp_unit, data); @@ -251,6 +253,7 @@ uint32_t SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!(resolve_scope & (eSymbolContextCompUnit | eSymbolContextLineEntry))) return 0; @@ -275,6 +278,7 @@ SymbolFileBreakpad::ResolveSymbolContext(const Address &so_addr, uint32_t SymbolFileBreakpad::ResolveSymbolContext( const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!(resolve_scope & eSymbolContextCompUnit)) return 0; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index f8ce1442698..125658d8b4e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -197,8 +197,6 @@ SymbolFile *SymbolFileDWARF::CreateInstance(ObjectFile *obj_file) { } TypeList &SymbolFileDWARF::GetTypeList() { - // This method can be called without going through the symbol vendor so we - // need to lock the module. std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile()) return debug_map_symfile->GetTypeList(); @@ -279,7 +277,7 @@ size_t SymbolFileDWARF::GetTypes(SymbolContextScope *sc_scope, TypeClass type_mask, TypeList &type_list) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); TypeSet type_set; CompileUnit *comp_unit = nullptr; @@ -754,7 +752,7 @@ bool SymbolFileDWARF::FixupAddress(Address &addr) { return true; } lldb::LanguageType SymbolFileDWARF::ParseLanguage(CompileUnit &comp_unit) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); if (dwarf_cu) return dwarf_cu->GetLanguageType(); @@ -763,7 +761,7 @@ lldb::LanguageType SymbolFileDWARF::ParseLanguage(CompileUnit &comp_unit) { } size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); if (!dwarf_cu) return 0; @@ -783,7 +781,7 @@ size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) { bool SymbolFileDWARF::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (DWARFUnit *unit = GetDWARFCompileUnit(&comp_unit)) { const dw_offset_t stmt_list = unit->GetLineTableOffset(); if (stmt_list != DW_INVALID_OFFSET) { @@ -833,7 +831,7 @@ SymbolFileDWARF::GetTypeUnitSupportFiles(DWARFTypeUnit &tu) { } bool SymbolFileDWARF::ParseIsOptimized(CompileUnit &comp_unit) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); if (dwarf_cu) return dwarf_cu->GetIsOptimized(); @@ -843,7 +841,7 @@ bool SymbolFileDWARF::ParseIsOptimized(CompileUnit &comp_unit) { bool SymbolFileDWARF::ParseImportedModules( const lldb_private::SymbolContext &sc, std::vector<SourceModule> &imported_modules) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (!dwarf_cu) @@ -1013,7 +1011,7 @@ SymbolFileDWARF::ParseDebugMacros(lldb::offset_t *offset) { } bool SymbolFileDWARF::ParseDebugMacros(CompileUnit &comp_unit) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); if (dwarf_cu == nullptr) @@ -1272,8 +1270,6 @@ SymbolFileDWARF::GetDeclContextForUID(lldb::user_id_t type_uid) { CompilerDeclContext SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) { - // This method can be called without going through the symbol vendor so we - // need to lock the module. std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // Anytime we have a lldb::user_id_t, we must get the DIE by calling // SymbolFileDWARF::GetDIE(). See comments inside the @@ -1284,8 +1280,6 @@ SymbolFileDWARF::GetDeclContextContainingUID(lldb::user_id_t type_uid) { } Type *SymbolFileDWARF::ResolveTypeUID(lldb::user_id_t type_uid) { - // This method can be called without going through the symbol vendor so we - // need to lock the module. std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // Anytime we have a lldb::user_id_t, we must get the DIE by calling // SymbolFileDWARF::GetDIE(). See comments inside the @@ -1685,6 +1679,7 @@ SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() { uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARF::" @@ -1828,6 +1823,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const FileSpec &file_spec, bool check_inlines, SymbolContextItem resolve_scope, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); const uint32_t prev_size = sc_list.GetSize(); if (resolve_scope & eSymbolContextCompUnit) { for (uint32_t cu_idx = 0, num_cus = GetNumCompileUnits(); cu_idx < num_cus; @@ -1970,6 +1966,7 @@ bool SymbolFileDWARF::DeclContextMatchesThisSymbolFile( uint32_t SymbolFileDWARF::FindGlobalVariables( ConstString name, const CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); if (log) @@ -2078,6 +2075,7 @@ uint32_t SymbolFileDWARF::FindGlobalVariables( uint32_t SymbolFileDWARF::FindGlobalVariables(const RegularExpression ®ex, uint32_t max_matches, VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); if (log) { @@ -2205,6 +2203,7 @@ uint32_t SymbolFileDWARF::FindFunctions( ConstString name, const CompilerDeclContext *parent_decl_ctx, FunctionNameType name_type_mask, bool include_inlines, bool append, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARF::FindFunctions (name = '%s')", name.AsCString()); @@ -2268,6 +2267,7 @@ uint32_t SymbolFileDWARF::FindFunctions( uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression ®ex, bool include_inlines, bool append, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARF::FindFunctions (regex = '%s')", regex.GetText().str().c_str()); @@ -2341,6 +2341,7 @@ uint32_t SymbolFileDWARF::FindTypes( bool append, uint32_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // If we aren't appending the results to this list, then clear the list if (!append) types.Clear(); @@ -2440,6 +2441,7 @@ uint32_t SymbolFileDWARF::FindTypes( size_t SymbolFileDWARF::FindTypes(const std::vector<CompilerContext> &context, bool append, TypeMap &types) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) types.Clear(); @@ -2486,6 +2488,7 @@ size_t SymbolFileDWARF::FindTypes(const std::vector<CompilerContext> &context, CompilerDeclContext SymbolFileDWARF::FindNamespace(ConstString name, const CompilerDeclContext *parent_decl_ctx) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); if (log) { @@ -3009,7 +3012,7 @@ size_t SymbolFileDWARF::ParseTypes(const SymbolContext &sc, } size_t SymbolFileDWARF::ParseBlocksRecursive(Function &func) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); CompileUnit *comp_unit = func.GetCompileUnit(); lldbassert(comp_unit); @@ -3029,7 +3032,7 @@ size_t SymbolFileDWARF::ParseBlocksRecursive(Function &func) { } size_t SymbolFileDWARF::ParseTypes(CompileUnit &comp_unit) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t types_added = 0; DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit); if (dwarf_cu) { @@ -3045,7 +3048,7 @@ size_t SymbolFileDWARF::ParseTypes(CompileUnit &comp_unit) { } size_t SymbolFileDWARF::ParseVariablesForContext(const SymbolContext &sc) { - ASSERT_MODULE_LOCK(this); + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (sc.comp_unit != nullptr) { DWARFDebugInfo *info = DebugInfo(); if (info == nullptr) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 5716e3d7326..2a1a84027c5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -623,6 +623,7 @@ size_t SymbolFileDWARFDebugMap::GetCompUnitInfosForModule( lldb::LanguageType SymbolFileDWARFDebugMap::ParseLanguage(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseLanguage(comp_unit); @@ -630,6 +631,7 @@ SymbolFileDWARFDebugMap::ParseLanguage(CompileUnit &comp_unit) { } size_t SymbolFileDWARFDebugMap::ParseFunctions(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseFunctions(comp_unit); @@ -637,6 +639,7 @@ size_t SymbolFileDWARFDebugMap::ParseFunctions(CompileUnit &comp_unit) { } bool SymbolFileDWARFDebugMap::ParseLineTable(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseLineTable(comp_unit); @@ -644,6 +647,7 @@ bool SymbolFileDWARFDebugMap::ParseLineTable(CompileUnit &comp_unit) { } bool SymbolFileDWARFDebugMap::ParseDebugMacros(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseDebugMacros(comp_unit); @@ -652,6 +656,7 @@ bool SymbolFileDWARFDebugMap::ParseDebugMacros(CompileUnit &comp_unit) { bool SymbolFileDWARFDebugMap::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseSupportFiles(comp_unit, support_files); @@ -659,6 +664,7 @@ bool SymbolFileDWARFDebugMap::ParseSupportFiles(CompileUnit &comp_unit, } bool SymbolFileDWARFDebugMap::ParseIsOptimized(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseIsOptimized(comp_unit); @@ -667,6 +673,7 @@ bool SymbolFileDWARFDebugMap::ParseIsOptimized(CompileUnit &comp_unit) { bool SymbolFileDWARFDebugMap::ParseImportedModules( const SymbolContext &sc, std::vector<SourceModule> &imported_modules) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(sc); if (oso_dwarf) return oso_dwarf->ParseImportedModules(sc, imported_modules); @@ -674,6 +681,7 @@ bool SymbolFileDWARFDebugMap::ParseImportedModules( } size_t SymbolFileDWARFDebugMap::ParseBlocksRecursive(Function &func) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); CompileUnit *comp_unit = func.GetCompileUnit(); if (!comp_unit) return 0; @@ -685,6 +693,7 @@ size_t SymbolFileDWARFDebugMap::ParseBlocksRecursive(Function &func) { } size_t SymbolFileDWARFDebugMap::ParseTypes(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(comp_unit); if (oso_dwarf) return oso_dwarf->ParseTypes(comp_unit); @@ -693,6 +702,7 @@ size_t SymbolFileDWARFDebugMap::ParseTypes(CompileUnit &comp_unit) { size_t SymbolFileDWARFDebugMap::ParseVariablesForContext(const SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); SymbolFileDWARF *oso_dwarf = GetSymbolFile(sc); if (oso_dwarf) return oso_dwarf->ParseVariablesForContext(sc); @@ -700,6 +710,7 @@ SymbolFileDWARFDebugMap::ParseVariablesForContext(const SymbolContext &sc) { } Type *SymbolFileDWARFDebugMap::ResolveTypeUID(lldb::user_id_t type_uid) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); const uint64_t oso_idx = GetOSOIndexFromUserID(type_uid); SymbolFileDWARF *oso_dwarf = GetSymbolFileByOSOIndex(oso_idx); if (oso_dwarf) @@ -736,6 +747,7 @@ uint32_t SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); uint32_t resolved_flags = 0; Symtab *symtab = m_obj_file->GetSymtab(); if (symtab) { @@ -778,6 +790,7 @@ SymbolFileDWARFDebugMap::ResolveSymbolContext(const Address &exe_so_addr, uint32_t SymbolFileDWARFDebugMap::ResolveSymbolContext( const FileSpec &file_spec, uint32_t line, bool check_inlines, SymbolContextItem resolve_scope, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); const uint32_t initial = sc_list.GetSize(); const uint32_t cu_count = GetNumCompileUnits(); @@ -832,6 +845,7 @@ uint32_t SymbolFileDWARFDebugMap::PrivateFindGlobalVariables( uint32_t SymbolFileDWARFDebugMap::FindGlobalVariables( ConstString name, const CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // Remember how many variables are in the list before we search. const uint32_t original_size = variables.GetSize(); @@ -868,6 +882,7 @@ uint32_t SymbolFileDWARFDebugMap::FindGlobalVariables(const RegularExpression ®ex, uint32_t max_matches, VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // Remember how many variables are in the list before we search. const uint32_t original_size = variables.GetSize(); @@ -995,6 +1010,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions( ConstString name, const CompilerDeclContext *parent_decl_ctx, FunctionNameType name_type_mask, bool include_inlines, bool append, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARFDebugMap::FindFunctions (name = %s)", @@ -1023,6 +1039,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex, bool include_inlines, bool append, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')", @@ -1050,6 +1067,7 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex, size_t SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope, lldb::TypeClass type_mask, TypeList &type_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); static Timer::Category func_cat(LLVM_PRETTY_FUNCTION); Timer scoped_timer(func_cat, "SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)", @@ -1180,6 +1198,7 @@ uint32_t SymbolFileDWARFDebugMap::FindTypes( bool append, uint32_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) types.Clear(); @@ -1210,6 +1229,7 @@ uint32_t SymbolFileDWARFDebugMap::FindTypes( CompilerDeclContext SymbolFileDWARFDebugMap::FindNamespace( lldb_private::ConstString name, const CompilerDeclContext *parent_decl_ctx) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); CompilerDeclContext matching_namespace; ForEachSymbolFile([&](SymbolFileDWARF *oso_dwarf) -> bool { diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp index e7ff32832b9..572ec7d6fc5 100644 --- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp @@ -899,6 +899,7 @@ lldb::CompUnitSP SymbolFileNativePDB::ParseCompileUnitAtIndex(uint32_t index) { } lldb::LanguageType SymbolFileNativePDB::ParseLanguage(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); PdbSymUid uid(comp_unit.GetID()); lldbassert(uid.kind() == PdbSymUidKind::Compiland); @@ -914,6 +915,7 @@ lldb::LanguageType SymbolFileNativePDB::ParseLanguage(CompileUnit &comp_unit) { void SymbolFileNativePDB::AddSymbols(Symtab &symtab) { return; } size_t SymbolFileNativePDB::ParseFunctions(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); PdbSymUid uid{comp_unit.GetID()}; lldbassert(uid.kind() == PdbSymUidKind::Compiland); uint16_t modi = uid.asCompiland().modi; @@ -947,6 +949,7 @@ static bool NeedsResolvedCompileUnit(uint32_t resolve_scope) { uint32_t SymbolFileNativePDB::ResolveSymbolContext( const Address &addr, SymbolContextItem resolve_scope, SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); uint32_t resolved_flags = 0; lldb::addr_t file_addr = addr.GetFileAddress(); @@ -1051,6 +1054,7 @@ bool SymbolFileNativePDB::ParseLineTable(CompileUnit &comp_unit) { // all at once, even if all it really needs is line info for a specific // function. In the future it would be nice if it could set the sc.m_function // member, and we could only get the line info for the function in question. + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); PdbSymUid cu_id(comp_unit.GetID()); lldbassert(cu_id.kind() == PdbSymUidKind::Compiland); CompilandIndexItem *cci = @@ -1129,6 +1133,7 @@ bool SymbolFileNativePDB::ParseDebugMacros(CompileUnit &comp_unit) { bool SymbolFileNativePDB::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); PdbSymUid cu_id(comp_unit.GetID()); lldbassert(cu_id.kind() == PdbSymUidKind::Compiland); CompilandIndexItem *cci = @@ -1159,6 +1164,7 @@ bool SymbolFileNativePDB::ParseImportedModules( } size_t SymbolFileNativePDB::ParseBlocksRecursive(Function &func) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); GetOrCreateBlock(PdbSymUid(func.GetID()).asCompilandSym()); // FIXME: Parse child blocks return 1; @@ -1169,6 +1175,7 @@ void SymbolFileNativePDB::DumpClangAST(Stream &s) { m_ast->Dump(s); } uint32_t SymbolFileNativePDB::FindGlobalVariables( ConstString name, const CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); using SymbolAndOffset = std::pair<uint32_t, llvm::codeview::CVSymbol>; std::vector<SymbolAndOffset> results = m_index->globals().findRecordsByName( @@ -1197,6 +1204,7 @@ uint32_t SymbolFileNativePDB::FindFunctions( ConstString name, const CompilerDeclContext *parent_decl_ctx, FunctionNameType name_type_mask, bool include_inlines, bool append, SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // For now we only support lookup by method name. if (!(name_type_mask & eFunctionNameTypeMethod)) return 0; @@ -1238,6 +1246,7 @@ uint32_t SymbolFileNativePDB::FindTypes( ConstString name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet<SymbolFile *> &searched_symbol_files, TypeMap &types) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) types.Clear(); if (!name) @@ -1279,6 +1288,7 @@ size_t SymbolFileNativePDB::FindTypesByName(llvm::StringRef name, } size_t SymbolFileNativePDB::ParseTypes(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); // Only do the full type scan the first time. if (m_done_full_type_scan) return 0; @@ -1475,6 +1485,7 @@ size_t SymbolFileNativePDB::ParseVariablesForBlock(PdbCompilandSymId block_id) { } size_t SymbolFileNativePDB::ParseVariablesForContext(const SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); lldbassert(sc.function || sc.comp_unit); VariableListSP variables; @@ -1528,6 +1539,7 @@ SymbolFileNativePDB::GetDeclContextContainingUID(lldb::user_id_t uid) { } Type *SymbolFileNativePDB::ResolveTypeUID(lldb::user_id_t type_uid) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); auto iter = m_types.find(type_uid); // lldb should not be passing us non-sensical type uids. the only way it // could have a type uid in the first place is if we handed it out, in which diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp index 4fea49c287a..2a3240692e3 100644 --- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp +++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp @@ -257,6 +257,7 @@ lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitAtIndex(uint32_t index) { } lldb::LanguageType SymbolFilePDB::ParseLanguage(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID()); if (!compiland_up) return lldb::eLanguageTypeUnknown; @@ -311,6 +312,7 @@ SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func, } size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t func_added = 0; auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID()); if (!compiland_up) @@ -329,6 +331,7 @@ size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) { } bool SymbolFilePDB::ParseLineTable(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (comp_unit.GetLineTable()) return true; return ParseCompileUnitLineTable(comp_unit, 0); @@ -347,6 +350,7 @@ bool SymbolFilePDB::ParseSupportFiles( // second time seems like a waste. Unfortunately, there's no good way around // this short of a moderate refactor since SymbolVendor depends on being able // to cache this list. + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID()); if (!compiland_up) return false; @@ -424,6 +428,7 @@ static size_t ParseFunctionBlocksForPDBSymbol( } size_t SymbolFilePDB::ParseBlocksRecursive(Function &func) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t num_added = 0; auto uid = func.GetID(); auto pdb_func_up = m_session_up->getConcreteSymbolById<PDBSymbolFunc>(uid); @@ -436,6 +441,7 @@ size_t SymbolFilePDB::ParseBlocksRecursive(Function &func) { } size_t SymbolFilePDB::ParseTypes(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t num_added = 0; auto compiland = GetPDBCompilandByUID(comp_unit.GetID()); @@ -488,6 +494,7 @@ size_t SymbolFilePDB::ParseTypes(CompileUnit &comp_unit) { size_t SymbolFilePDB::ParseVariablesForContext(const lldb_private::SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!sc.comp_unit) return 0; @@ -536,6 +543,7 @@ SymbolFilePDB::ParseVariablesForContext(const lldb_private::SymbolContext &sc) { } lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); auto find_result = m_types.find(type_uid); if (find_result != m_types.end()) return find_result->second.get(); @@ -666,6 +674,7 @@ uint32_t SymbolFilePDB::ResolveSymbolContext(const lldb_private::Address &so_addr, SymbolContextItem resolve_scope, lldb_private::SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); uint32_t resolved_flags = 0; if (resolve_scope & eSymbolContextCompUnit || resolve_scope & eSymbolContextVariable || @@ -726,6 +735,7 @@ SymbolFilePDB::ResolveSymbolContext(const lldb_private::Address &so_addr, uint32_t SymbolFilePDB::ResolveSymbolContext( const lldb_private::FileSpec &file_spec, uint32_t line, bool check_inlines, SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); const size_t old_size = sc_list.GetSize(); if (resolve_scope & lldb::eSymbolContextCompUnit) { // Locate all compilation units with line numbers referencing the specified @@ -1038,6 +1048,7 @@ uint32_t SymbolFilePDB::FindGlobalVariables( lldb_private::ConstString name, const lldb_private::CompilerDeclContext *parent_decl_ctx, uint32_t max_matches, lldb_private::VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx)) return 0; if (name.IsEmpty()) @@ -1082,6 +1093,7 @@ uint32_t SymbolFilePDB::FindGlobalVariables(const lldb_private::RegularExpression ®ex, uint32_t max_matches, lldb_private::VariableList &variables) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!regex.IsValid()) return 0; auto results = m_global_scope_up->findAllChildren<PDBSymbolData>(); @@ -1239,6 +1251,7 @@ uint32_t SymbolFilePDB::FindFunctions( const lldb_private::CompilerDeclContext *parent_decl_ctx, FunctionNameType name_type_mask, bool include_inlines, bool append, lldb_private::SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) sc_list.Clear(); lldbassert((name_type_mask & eFunctionNameTypeAuto) == 0); @@ -1294,6 +1307,7 @@ uint32_t SymbolFilePDB::FindFunctions(const lldb_private::RegularExpression ®ex, bool include_inlines, bool append, lldb_private::SymbolContextList &sc_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) sc_list.Clear(); if (!regex.IsValid()) @@ -1380,6 +1394,7 @@ uint32_t SymbolFilePDB::FindTypes( uint32_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, lldb_private::TypeMap &types) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (!append) types.Clear(); if (!name) @@ -1567,6 +1582,7 @@ void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol, size_t SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope, TypeClass type_mask, lldb_private::TypeList &type_list) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); TypeCollection type_collection; uint32_t old_size = type_list.GetSize(); CompileUnit *cu = @@ -1615,6 +1631,7 @@ PDBASTParser *SymbolFilePDB::GetPDBAstParser() { lldb_private::CompilerDeclContext SymbolFilePDB::FindNamespace( lldb_private::ConstString name, const lldb_private::CompilerDeclContext *parent_decl_ctx) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); auto type_system = GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus); auto clang_type_system = llvm::dyn_cast_or_null<ClangASTContext>(type_system); if (!clang_type_system) diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index ae0499d5ee6..2782fce4d62 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -136,6 +136,7 @@ lldb::LanguageType SymbolFileSymtab::ParseLanguage(CompileUnit &comp_unit) { } size_t SymbolFileSymtab::ParseFunctions(CompileUnit &comp_unit) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); size_t num_added = 0; // We must at least have a valid compile unit const Symtab *symtab = m_obj_file->GetSymtab(); @@ -246,6 +247,7 @@ bool SymbolFileSymtab::CompleteType(lldb_private::CompilerType &compiler_type) { uint32_t SymbolFileSymtab::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); if (m_obj_file->GetSymtab() == nullptr) return 0; diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp index be895b645cf..c7557f9d651 100644 --- a/lldb/source/Symbol/SymbolFile.cpp +++ b/lldb/source/Symbol/SymbolFile.cpp @@ -179,6 +179,7 @@ uint32_t SymbolFile::GetNumCompileUnits() { } CompUnitSP SymbolFile::GetCompileUnitAtIndex(uint32_t idx) { + std::lock_guard<std::recursive_mutex> guard(GetModuleMutex()); uint32_t num = GetNumCompileUnits(); if (idx >= num) return nullptr; diff --git a/lldb/source/Symbol/SymbolVendor.cpp b/lldb/source/Symbol/SymbolVendor.cpp index 19b02da34c2..180ddbcab79 100644 --- a/lldb/source/Symbol/SymbolVendor.cpp +++ b/lldb/source/Symbol/SymbolVendor.cpp @@ -76,135 +76,83 @@ void SymbolVendor::AddSymbolFileRepresentation(const ObjectFileSP &objfile_sp) { } size_t SymbolVendor::GetNumCompileUnits() { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->GetNumCompileUnits(); - } + if (m_sym_file_up) + return m_sym_file_up->GetNumCompileUnits(); return 0; } lldb::LanguageType SymbolVendor::ParseLanguage(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseLanguage(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseLanguage(comp_unit); return eLanguageTypeUnknown; } size_t SymbolVendor::ParseFunctions(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseFunctions(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseFunctions(comp_unit); return 0; } bool SymbolVendor::ParseLineTable(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseLineTable(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseLineTable(comp_unit); return false; } bool SymbolVendor::ParseDebugMacros(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseDebugMacros(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseDebugMacros(comp_unit); return false; } bool SymbolVendor::ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseSupportFiles(comp_unit, support_files); - } + if (m_sym_file_up) + return m_sym_file_up->ParseSupportFiles(comp_unit, support_files); return false; } bool SymbolVendor::ParseIsOptimized(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseIsOptimized(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseIsOptimized(comp_unit); return false; } bool SymbolVendor::ParseImportedModules( const SymbolContext &sc, std::vector<SourceModule> &imported_modules) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseImportedModules(sc, imported_modules); - } + if (m_sym_file_up) + return m_sym_file_up->ParseImportedModules(sc, imported_modules); return false; } size_t SymbolVendor::ParseBlocksRecursive(Function &func) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseBlocksRecursive(func); - } + if (m_sym_file_up) + return m_sym_file_up->ParseBlocksRecursive(func); return 0; } size_t SymbolVendor::ParseTypes(CompileUnit &comp_unit) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseTypes(comp_unit); - } + if (m_sym_file_up) + return m_sym_file_up->ParseTypes(comp_unit); return 0; } size_t SymbolVendor::ParseVariablesForContext(const SymbolContext &sc) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ParseVariablesForContext(sc); - } + if (m_sym_file_up) + return m_sym_file_up->ParseVariablesForContext(sc); return 0; } Type *SymbolVendor::ResolveTypeUID(lldb::user_id_t type_uid) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ResolveTypeUID(type_uid); - } + if (m_sym_file_up) + return m_sym_file_up->ResolveTypeUID(type_uid); return nullptr; } uint32_t SymbolVendor::ResolveSymbolContext(const Address &so_addr, SymbolContextItem resolve_scope, SymbolContext &sc) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ResolveSymbolContext(so_addr, resolve_scope, sc); - } + if (m_sym_file_up) + return m_sym_file_up->ResolveSymbolContext(so_addr, resolve_scope, sc); return 0; } @@ -212,13 +160,9 @@ uint32_t SymbolVendor::ResolveSymbolContext(const FileSpec &file_spec, uint32_t line, bool check_inlines, SymbolContextItem resolve_scope, SymbolContextList &sc_list) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->ResolveSymbolContext(file_spec, line, check_inlines, - resolve_scope, sc_list); - } + if (m_sym_file_up) + return m_sym_file_up->ResolveSymbolContext(file_spec, line, check_inlines, + resolve_scope, sc_list); return 0; } @@ -226,25 +170,17 @@ size_t SymbolVendor::FindGlobalVariables(ConstString name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, VariableList &variables) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindGlobalVariables(name, parent_decl_ctx, - max_matches, variables); - } + if (m_sym_file_up) + return m_sym_file_up->FindGlobalVariables(name, parent_decl_ctx, + max_matches, variables); return 0; } size_t SymbolVendor::FindGlobalVariables(const RegularExpression ®ex, size_t max_matches, VariableList &variables) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindGlobalVariables(regex, max_matches, variables); - } + if (m_sym_file_up) + return m_sym_file_up->FindGlobalVariables(regex, max_matches, variables); return 0; } @@ -253,26 +189,18 @@ size_t SymbolVendor::FindFunctions(ConstString name, FunctionNameType name_type_mask, bool include_inlines, bool append, SymbolContextList &sc_list) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindFunctions(name, parent_decl_ctx, name_type_mask, - include_inlines, append, sc_list); - } + if (m_sym_file_up) + return m_sym_file_up->FindFunctions(name, parent_decl_ctx, name_type_mask, + include_inlines, append, sc_list); return 0; } size_t SymbolVendor::FindFunctions(const RegularExpression ®ex, bool include_inlines, bool append, SymbolContextList &sc_list) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindFunctions(regex, include_inlines, append, - sc_list); - } + if (m_sym_file_up) + return m_sym_file_up->FindFunctions(regex, include_inlines, append, + sc_list); return 0; } @@ -281,14 +209,9 @@ size_t SymbolVendor::FindTypes( bool append, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindTypes(name, parent_decl_ctx, append, - max_matches, searched_symbol_files, - types); - } + if (m_sym_file_up) + return m_sym_file_up->FindTypes(name, parent_decl_ctx, append, max_matches, + searched_symbol_files, types); if (!append) types.Clear(); return 0; @@ -296,12 +219,8 @@ size_t SymbolVendor::FindTypes( size_t SymbolVendor::FindTypes(const std::vector<CompilerContext> &context, bool append, TypeMap &types) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->FindTypes(context, append, types); - } + if (m_sym_file_up) + return m_sym_file_up->FindTypes(context, append, types); if (!append) types.Clear(); return 0; @@ -309,12 +228,8 @@ size_t SymbolVendor::FindTypes(const std::vector<CompilerContext> &context, size_t SymbolVendor::GetTypes(SymbolContextScope *sc_scope, TypeClass type_mask, lldb_private::TypeList &type_list) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->GetTypes(sc_scope, type_mask, type_list); - } + if (m_sym_file_up) + return m_sym_file_up->GetTypes(sc_scope, type_mask, type_list); return 0; } @@ -322,12 +237,8 @@ CompilerDeclContext SymbolVendor::FindNamespace(ConstString name, const CompilerDeclContext *parent_decl_ctx) { CompilerDeclContext namespace_decl_ctx; - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - namespace_decl_ctx = m_sym_file_up->FindNamespace(name, parent_decl_ctx); - } + if (m_sym_file_up) + namespace_decl_ctx = m_sym_file_up->FindNamespace(name, parent_decl_ctx); return namespace_decl_ctx; } @@ -364,12 +275,8 @@ void SymbolVendor::Dump(Stream *s) { } CompUnitSP SymbolVendor::GetCompileUnitAtIndex(size_t idx) { - ModuleSP module_sp(GetModule()); - if (module_sp) { - std::lock_guard<std::recursive_mutex> guard(module_sp->GetMutex()); - if (m_sym_file_up) - return m_sym_file_up->GetCompileUnitAtIndex(idx); - } + if (m_sym_file_up) + return m_sym_file_up->GetCompileUnitAtIndex(idx); return nullptr; } |