From 286fb1ef32243f29c984b4559b1a1207c8af96cd Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 28 Feb 2014 02:52:06 +0000 Subject: [PATCH] Plumb the EvaluateExpressionOptions::{Set,Get}StopOthers through the SB API, and make it work in RunThreadPlan. Also remove SetStopOthers from the ThreadPlanCallFunction, because if the value you have doesn't match what is in the EvaluateExpressionOptions the plan was passed when created it won't work correctly. llvm-svn: 202464 --- lldb/include/lldb/API/SBExpressionOptions.h | 6 ++++++ lldb/include/lldb/Target/ThreadPlanCallFunction.h | 3 --- lldb/scripts/Python/interface/SBExpressionOptions.i | 7 +++++++ lldb/source/API/SBExpressionOptions.cpp | 12 ++++++++++++ lldb/source/Target/Process.cpp | 7 ++++++- lldb/source/Target/ThreadPlanCallFunction.cpp | 11 ----------- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/lldb/include/lldb/API/SBExpressionOptions.h b/lldb/include/lldb/API/SBExpressionOptions.h index 6a3a640432f6..ac5ce952a623 100644 --- a/lldb/include/lldb/API/SBExpressionOptions.h +++ b/lldb/include/lldb/API/SBExpressionOptions.h @@ -64,6 +64,12 @@ public: void SetTryAllThreads (bool run_others = true); + + bool + GetStopOthers() const; + + void + SetStopOthers(bool stop_others = true); bool GetTrapExceptions () const; diff --git a/lldb/include/lldb/Target/ThreadPlanCallFunction.h b/lldb/include/lldb/Target/ThreadPlanCallFunction.h index 18f1d0facbf6..d8d8cb19dfaa 100644 --- a/lldb/include/lldb/Target/ThreadPlanCallFunction.h +++ b/lldb/include/lldb/Target/ThreadPlanCallFunction.h @@ -52,9 +52,6 @@ public: virtual bool StopOthers (); - virtual void - SetStopOthers (bool new_value); - virtual lldb::StateType GetPlanRunState (); diff --git a/lldb/scripts/Python/interface/SBExpressionOptions.i b/lldb/scripts/Python/interface/SBExpressionOptions.i index 06b9be310de7..285410841974 100644 --- a/lldb/scripts/Python/interface/SBExpressionOptions.i +++ b/lldb/scripts/Python/interface/SBExpressionOptions.i @@ -71,6 +71,13 @@ public: void SetTryAllThreads (bool run_others = true); + bool + GetStopOthers () const; + + %feature("docstring", "Sets whether to stop other threads at all while running expressins. If false, TryAllThreads does nothing.") SetTryAllThreads; + void + SetStopOthers (bool stop_others = true); + bool GetTrapExceptions () const; diff --git a/lldb/source/API/SBExpressionOptions.cpp b/lldb/source/API/SBExpressionOptions.cpp index ae1c8f99df30..b426cd1845f4 100644 --- a/lldb/source/API/SBExpressionOptions.cpp +++ b/lldb/source/API/SBExpressionOptions.cpp @@ -113,6 +113,18 @@ SBExpressionOptions::SetTryAllThreads (bool run_others) m_opaque_ap->SetTryAllThreads (run_others); } +bool +SBExpressionOptions::GetStopOthers () const +{ + return m_opaque_ap->GetStopOthers (); +} + +void +SBExpressionOptions::SetStopOthers (bool run_others) +{ + m_opaque_ap->SetStopOthers (run_others); +} + bool SBExpressionOptions::GetTrapExceptions () const { diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 7a7172fa5c1c..b78790285142 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -5118,7 +5118,12 @@ Process::RunThreadPlan (ExecutionContext &exe_ctx, TimeValue final_timeout = one_thread_timeout; uint32_t timeout_usec = options.GetTimeoutUsec(); - if (options.GetTryAllThreads()) + if (!options.GetStopOthers()) + { + before_first_timeout = false; + final_timeout.OffsetWithMicroSeconds(timeout_usec); + } + else if (options.GetTryAllThreads()) { // If we are running all threads then we take half the time to run all threads, bounded by // .25 sec. diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 854750b85817..e465dcf21d7a 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -425,17 +425,6 @@ ThreadPlanCallFunction::StopOthers () return m_stop_other_threads; } -void -ThreadPlanCallFunction::SetStopOthers (bool new_value) -{ - if (m_subplan_sp) - { - ThreadPlanRunToAddress *address_plan = static_cast(m_subplan_sp.get()); - address_plan->SetStopOthers(new_value); - } - m_stop_other_threads = new_value; -} - StateType ThreadPlanCallFunction::GetPlanRunState () {