summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/SymbolFile/DWARF
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/DWARF')
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp35
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp20
2 files changed, 39 insertions, 16 deletions
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 &regex,
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 &regex,
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 &regex,
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 &regex,
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 &regex,
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 {
OpenPOWER on IntegriCloud