summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-05-10 23:48:10 +0000
committerGreg Clayton <gclayton@apple.com>2013-05-10 23:48:10 +0000
commitf9b57b9d77cd2b69073310cf265206e4452b0ac8 (patch)
tree954191a290a66ef52af11c5c26c84ecf2930ae50 /lldb/source/Target/Process.cpp
parent2b93c54c4a93c16c3d75ae996f916ec3b9b4a60b (diff)
downloadbcm5719-llvm-f9b57b9d77cd2b69073310cf265206e4452b0ac8.tar.gz
bcm5719-llvm-f9b57b9d77cd2b69073310cf265206e4452b0ac8.zip
<rdar://problem/13700260>
Avoid a deadlock when using the OperatingSystemPython code and typing "process interrupt". There was a possible lock inversion between the target API lock and the process' thread list lock due to code trying to discard the thread list. This was fixed by adding a boolean to Process::Halt() that indicates if the thread plans should be discarded and doing it in the private state thread when we process the stopped state. llvm-svn: 181651
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f4733c38d76..652505252f1 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1035,6 +1035,7 @@ Process::Process(Target &target, Listener &listener) :
m_private_run_lock (),
m_currently_handling_event(false),
m_finalize_called(false),
+ m_clear_thread_plans_on_stop (false),
m_last_broadcast_state (eStateInvalid),
m_destroy_in_process (false),
m_can_jit(eCanJITDontKnow)
@@ -3332,8 +3333,13 @@ Process::PrivateResume ()
}
Error
-Process::Halt ()
+Process::Halt (bool clear_thread_plans)
{
+ // Don't clear the m_clear_thread_plans_on_stop, only set it to true if
+ // in case it was already set and some thread plan logic calls halt on its
+ // own.
+ m_clear_thread_plans_on_stop |= clear_thread_plans;
+
// First make sure we aren't in the middle of handling an event, or we might restart. This is pretty weak, since
// we could just straightaway get another event. It just narrows the window...
m_currently_handling_event.WaitForValueEqualTo(false);
@@ -4035,6 +4041,12 @@ Process::RunPrivateStateThread ()
if (internal_state != eStateInvalid)
{
+ if (m_clear_thread_plans_on_stop &&
+ StateIsStoppedState(internal_state, true))
+ {
+ m_clear_thread_plans_on_stop = false;
+ m_thread_list.DiscardThreadPlans();
+ }
HandlePrivateEvent (event_sp);
}
OpenPOWER on IntegriCloud