[Lldb-commits] [PATCH] D60468: Lock accesses to OptionValueFileSpecList objects

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 9 09:13:59 PDT 2019


friss created this revision.
friss added a reviewer: clayborg.

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. It's not a general
solution, and I'd like to hear your ideas about how to address this in a more
principled way, but given global properties are a thing, it seems like we
need locking at this level even if we were to do a bigger refectoring.


https://reviews.llvm.org/D60468

Files:
  include/lldb/Interpreter/OptionValueFileSpecList.h
  include/lldb/Target/Target.h
  include/lldb/Target/Thread.h
  source/Commands/CommandObjectTarget.cpp
  source/Interpreter/OptionValueFileSpecLIst.cpp
  source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Target/Target.cpp
  source/Target/TargetList.cpp
  source/Target/Thread.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60468.194352.patch
Type: text/x-patch
Size: 12698 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190409/cc3a4bcd/attachment.bin>


More information about the lldb-commits mailing list