diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 14 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 7ad5f7be935..4c406a4f2aa 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1470,7 +1470,7 @@ public: protected: bool DoExecute (Args& command, - CommandReturnObject &result) + CommandReturnObject &result) { Process *process = m_exe_ctx.GetProcessPtr(); if (process == NULL) @@ -1482,14 +1482,11 @@ protected: if (command.GetArgumentCount() == 0) { - Error error(process->Halt ()); + bool clear_thread_plans = true; + Error error(process->Halt (clear_thread_plans)); if (error.Success()) { result.SetStatus (eReturnStatusSuccessFinishResult); - - // Maybe we should add a "SuspendThreadPlans so we - // can halt, and keep in place all the current thread plans. - process->GetThreadList().DiscardThreadPlans(); } else { 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); } |