Lock accesses to OptionValueFileSpecList objects
authorFrederic Riss <friss@apple.com>
Tue, 23 Apr 2019 20:17:04 +0000 (20:17 +0000)
committerFrederic Riss <friss@apple.com>
Tue, 23 Apr 2019 20:17:04 +0000 (20:17 +0000)
commitacbf0058e93d3a8f95ea3ace586f99320ce1c425
treec964c8ce9523a880a063253b0801b80c51f2d3d1
parent5c3117b0a98dd11717eaffd7fb583985d39544b2
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
13 files changed:
lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
lldb/include/lldb/Target/Target.h
lldb/include/lldb/Target/Thread.h
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Target/Target.cpp
lldb/source/Target/TargetList.cpp
lldb/source/Target/Thread.cpp