From acbf0058e93d3a8f95ea3ace586f99320ce1c425 Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Tue, 23 Apr 2019 20:17:04 +0000 Subject: Lock accesses to OptionValueFileSpecList objects Before a Debugger gets a Target, target settings are routed to a global set of settings. Even without this, some part of the LLDB which exist independently of the Debugger object (the Module cache, the Symbol vendors, ...) access directly the global default store for those settings. Of course, if you modify one of those global settings while they are being read, bad things happen. We see this quite a bit with FileSpecList settings. In particular, we see many cases where one debug session changes target.exec-search-paths while another session starts up and it crashes when one of those accesses invalid FileSpecs. This patch addresses the specific FileSpecList issue by adding locking to OptionValueFileSpecList and never returning by reference. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D60468 llvm-svn: 359028 --- lldb/source/Commands/CommandObjectTarget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lldb/source/Commands/CommandObjectTarget.cpp') diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 13437414471..bc59557fd6c 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -410,7 +410,7 @@ protected: } FileSpec core_file_dir; core_file_dir.GetDirectory() = core_file.GetDirectory(); - target_sp->GetExecutableSearchPaths().Append(core_file_dir); + target_sp->AppendExecutableSearchPaths(core_file_dir); ProcessSP process_sp(target_sp->CreateProcess( m_interpreter.GetDebugger().GetListener(), llvm::StringRef(), -- cgit v1.2.3