This change introduces a "ExpressionExecutionThread" to the ThreadList.
authorJim Ingham <jingham@apple.com>
Sat, 12 Mar 2016 02:45:34 +0000 (02:45 +0000)
committerJim Ingham <jingham@apple.com>
Sat, 12 Mar 2016 02:45:34 +0000 (02:45 +0000)
commit8d94ba0fb18e0b40631737b88f8c9a9abf025d80
tree989b16e9e7df44b37f4e6536efde4ea07fd51ff4
parentcf9732b4177bba5a073619f8f067cf4a0193b325
This change introduces a "ExpressionExecutionThread" to the ThreadList.

Turns out that most of the code that runs expressions (e.g. the ObjC runtime grubber) on
behalf of the expression parser was using the currently selected thread.  But sometimes,
e.g. when we are evaluating breakpoint conditions/commands, we don't select the thread
we're running on, we instead set the context for the interpreter, and explicitly pass
that to other callers.  That wasn't getting communicated to these utility expressions, so
they would run on some other thread instead, and that could cause a variety of subtle and
hard to reproduce problems.

I also went through the commands and cleaned up the use of GetSelectedThread.  All those
uses should have been trying the thread in the m_exe_ctx belonging to the command object
first.  It would actually have been pretty hard to get misbehavior in these cases, but for
correctness sake it is good to make this usage consistent.

<rdar://problem/24978569>

llvm-svn: 263326
15 files changed:
lldb/include/lldb/Interpreter/CommandObject.h
lldb/include/lldb/Target/ThreadList.h
lldb/source/Commands/CommandObjectProcess.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Commands/CommandObjectType.cpp
lldb/source/DataFormatters/FormattersHelpers.cpp
lldb/source/Interpreter/CommandObject.cpp
lldb/source/Plugins/InstrumentationRuntime/AddressSanitizer/AddressSanitizerRuntime.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
lldb/source/Plugins/MemoryHistory/asan/MemoryHistoryASan.cpp
lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp
lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/source/Target/StopInfo.cpp
lldb/source/Target/ThreadList.cpp