summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/Windows/Common
diff options
context:
space:
mode:
authorAdrian McCarthy <amccarth@google.com>2019-07-22 17:03:20 +0000
committerAdrian McCarthy <amccarth@google.com>2019-07-22 17:03:20 +0000
commit3f06210295051a413473e8f7d2b4a299c1f04635 (patch)
treef43dae6228d642edd317f784b64f073f83ebd664 /lldb/source/Plugins/Process/Windows/Common
parent7994e1d071cbd7d9e2736c97b538adce2773365d (diff)
downloadbcm5719-llvm-3f06210295051a413473e8f7d2b4a299c1f04635.tar.gz
bcm5719-llvm-3f06210295051a413473e8f7d2b4a299c1f04635.zip
[Windows] Fix race condition between state changes
Patch by Martin Andersson (martin.andersson@evoma.se) If the process is resumed before the state is changed to "running" there is a possibility (when single stepping) that the debugger stops and changes the state to "stopped" before it is first changed to "running". This causes the process to ignore the stop event (since the state did not change) which in turn leads the DebuggerThread to wait indefinitely for the exception predicate in HandleExceptionEvent. Differential Revision: https://reviews.llvm.org/D62183 llvm-svn: 366703
Diffstat (limited to 'lldb/source/Plugins/Process/Windows/Common')
-rw-r--r--lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
index 49801fecdb2..7303e177b46 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
@@ -205,16 +205,6 @@ Status ProcessWindows::DoResume() {
m_session_data->m_debugger->GetProcess().GetProcessId(),
GetPrivateState());
- ExceptionRecordSP active_exception =
- m_session_data->m_debugger->GetActiveException().lock();
- if (active_exception) {
- // Resume the process and continue processing debug events. Mask the
- // exception so that from the process's view, there is no indication that
- // anything happened.
- m_session_data->m_debugger->ContinueAsyncException(
- ExceptionResult::MaskException);
- }
-
LLDB_LOG(log, "resuming {0} threads.", m_thread_list.GetSize());
bool failed = false;
@@ -233,10 +223,19 @@ Status ProcessWindows::DoResume() {
if (failed) {
error.SetErrorString("ProcessWindows::DoResume failed");
- return error;
} else {
SetPrivateState(eStateRunning);
}
+
+ ExceptionRecordSP active_exception =
+ m_session_data->m_debugger->GetActiveException().lock();
+ if (active_exception) {
+ // Resume the process and continue processing debug events. Mask the
+ // exception so that from the process's view, there is no indication that
+ // anything happened.
+ m_session_data->m_debugger->ContinueAsyncException(
+ ExceptionResult::MaskException);
+ }
} else {
LLDB_LOG(log, "error: process {0} is in state {1}. Returning...",
m_session_data->m_debugger->GetProcess().GetProcessId(),
OpenPOWER on IntegriCloud