diff options
author | Jim Ingham <jingham@apple.com> | 2012-05-02 00:23:18 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-05-02 00:23:18 +0000 |
commit | 92e1cd431c62e623d16e34dfd2c159f100c1fce8 (patch) | |
tree | 3235ebedad25933a57fb2636fddf34d0db0fc072 | |
parent | 70de772d450f4200b207d36fb524c0bfad49a6a6 (diff) | |
download | bcm5719-llvm-92e1cd431c62e623d16e34dfd2c159f100c1fce8.tar.gz bcm5719-llvm-92e1cd431c62e623d16e34dfd2c159f100c1fce8.zip |
Cleanup - removing the ThreadPlanTestCondition and its helper functions. It is not needed,
since we now run the condition in the StopInfoBreakpoint's PerformAction, and don't need
to refer it to another "continue". Actually, we haven't needed to do this for a year or
so, I just hadn't gotten around to deleting the dead wood.
llvm-svn: 155967
-rw-r--r-- | lldb/include/lldb/Breakpoint/Breakpoint.h | 19 | ||||
-rw-r--r-- | lldb/include/lldb/Breakpoint/BreakpointLocation.h | 18 | ||||
-rw-r--r-- | lldb/include/lldb/Breakpoint/BreakpointOptions.h | 19 | ||||
-rw-r--r-- | lldb/include/lldb/Target/ThreadPlanTestCondition.h | 65 | ||||
-rw-r--r-- | lldb/source/Breakpoint/Breakpoint.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Breakpoint/BreakpointLocation.cpp | 9 | ||||
-rw-r--r-- | lldb/source/Breakpoint/BreakpointOptions.cpp | 45 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanTestCondition.cpp | 194 |
8 files changed, 1 insertions, 374 deletions
diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h b/lldb/include/lldb/Breakpoint/Breakpoint.h index 0a24f249aca..782cf456dfe 100644 --- a/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -412,25 +412,6 @@ public: void SetCondition (const char *condition); //------------------------------------------------------------------ - /// Test the breakpoint condition in the Execution context passed in. - /// - /// @param[in] exe_ctx - /// The execution context in which to evaluate this expression. - /// - /// @param[in] break_loc_sp - /// A shared pointer to the location that we are testing thsi condition for. - /// - /// @param[in] error - /// Error messages will be written to this stream. - /// - /// @return - /// A thread plan to run to test the condition or NULL if no condition. - //------------------------------------------------------------------ - ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, - lldb::BreakpointLocationSP break_loc_sp, - Stream &error); - - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// /// @return diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/lldb/include/lldb/Breakpoint/BreakpointLocation.h index 7ff062e9ddb..827f8110921 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -167,23 +167,7 @@ public: //------------------------------------------------------------------ void SetCondition (const char *condition); - - //------------------------------------------------------------------ - /// Test the breakpoint location's condition in the Execution context passed in. - /// - /// @param[in] exe_ctx - /// The execution context in which to evaluate this expression. - /// - /// @param[in] error - /// Error messages will be written to this stream. - /// - /// @return - /// A thread plan to run to test the condition, or NULL if there is no condition. - //------------------------------------------------------------------ - ThreadPlan * - GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, - Stream &error); - + //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// diff --git a/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/lldb/include/lldb/Breakpoint/BreakpointOptions.h index 5d590c5afa2..91227708458 100644 --- a/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -177,25 +177,6 @@ public: void SetCondition (const char *condition); //------------------------------------------------------------------ - /// Test the breakpoint condition in the Execution context passed in. - /// - /// @param[in] exe_ctx - /// The execution context in which to evaluate this expression. - /// - /// @param[in] break_loc_sp - /// A shared pointer to the location that we are testing thsi condition for. - /// - /// @param[in] error - /// Error messages will be written to this stream. - /// - /// @return - /// A thread plan to run to test the condition, or NULL if there is no thread plan. - //------------------------------------------------------------------ - ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, - const lldb::BreakpointLocationSP& break_loc_sp, - Stream &error); - - //------------------------------------------------------------------ /// Return a pointer to the text of the condition expression. /// /// @return diff --git a/lldb/include/lldb/Target/ThreadPlanTestCondition.h b/lldb/include/lldb/Target/ThreadPlanTestCondition.h deleted file mode 100644 index 974467c4f1f..00000000000 --- a/lldb/include/lldb/Target/ThreadPlanTestCondition.h +++ /dev/null @@ -1,65 +0,0 @@ -//===-- ThreadPlanTestCondition.h -----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ThreadPlanTestCondition_h_ -#define liblldb_ThreadPlanTestCondition_h_ - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes -#include "lldb/Core/AddressRange.h" -#include "lldb/Target/ExecutionContext.h" -#include "lldb/Expression/ClangUserExpression.h" -#include "lldb/Target/StackID.h" -#include "lldb/Target/Thread.h" -#include "lldb/Target/ThreadPlan.h" -#include "lldb/Target/ThreadPlanShouldStopHere.h" - -namespace lldb_private { - -class ThreadPlanTestCondition : public ThreadPlan -{ -public: - virtual ~ThreadPlanTestCondition (); - - ThreadPlanTestCondition (Thread &thread, - ExecutionContext &exe_ctx, - ClangUserExpression *expression, - const lldb::BreakpointLocationSP &break_loc_sp, - bool stop_others); - - virtual void GetDescription (Stream *s, lldb::DescriptionLevel level); - virtual bool ValidatePlan (Stream *error); - virtual bool PlanExplainsStop (); - virtual bool ShouldStop (Event *event_ptr); - virtual Vote ShouldReportStop (Event *event_ptr); - virtual bool StopOthers (); - virtual lldb::StateType GetPlanRunState (); - virtual bool WillStop (); - virtual bool MischiefManaged (); - virtual void DidPush (); - -protected: - -private: - ClangUserExpression *m_expression; - ExecutionContext m_exe_ctx; - lldb::ThreadPlanSP m_expression_plan_sp; - lldb::BreakpointLocationSP m_break_loc_sp; - bool m_did_stop; - bool m_stop_others; - - DISALLOW_COPY_AND_ASSIGN (ThreadPlanTestCondition); - -}; - -} // namespace lldb_private - -#endif // liblldb_ThreadPlanTestCondition_h_ diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 7a897661e76..62e1b248280 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -247,12 +247,6 @@ Breakpoint::SetCondition (const char *condition) SendBreakpointChangedEvent (eBreakpointEventTypeConditionChanged); } -ThreadPlan * -Breakpoint::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, lldb::BreakpointLocationSP loc_sp, Stream &error) -{ - return m_options.GetThreadPlanToTestCondition (exe_ctx, loc_sp, error); -} - const char * Breakpoint::GetConditionText () const { diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index c99eb466378..39f19eb8717 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -235,15 +235,6 @@ BreakpointLocation::SetCondition (const char *condition) SendBreakpointLocationChangedEvent (eBreakpointEventTypeConditionChanged); } -ThreadPlan * -BreakpointLocation::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error) -{ - if (m_options_ap.get()) - return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error); - else - return m_owner.GetThreadPlanToTestCondition (exe_ctx, shared_from_this(), error); -} - const char * BreakpointLocation::GetConditionText () const { diff --git a/lldb/source/Breakpoint/BreakpointOptions.cpp b/lldb/source/Breakpoint/BreakpointOptions.cpp index 79ffa32e3a2..99a7134a0e0 100644 --- a/lldb/source/Breakpoint/BreakpointOptions.cpp +++ b/lldb/source/Breakpoint/BreakpointOptions.cpp @@ -170,51 +170,6 @@ BreakpointOptions::SetCondition (const char *condition) } } -ThreadPlan * -BreakpointOptions::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, - const BreakpointLocationSP &break_loc_sp, - Stream &error_stream) -{ - // No condition means we should stop, so return NULL. - if (!m_condition_ap.get()) - return NULL; - - // FIXME: I shouldn't have to do this, the process should handle it for me: - Process *process = exe_ctx.GetProcessPtr(); - if (!process->GetDynamicCheckers()) - { - DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions(); - - StreamString install_errors; - - if (!dynamic_checkers->Install(install_errors, exe_ctx)) - { - error_stream.Printf("Couldn't install dynamic checkers into the execution context: %s\n", install_errors.GetData()); - return NULL; - } - - process->SetDynamicCheckers(dynamic_checkers); - } - - const bool keep_in_memory = false; - - if (!m_condition_ap->Parse (error_stream, exe_ctx, eExecutionPolicyAlways, keep_in_memory)) - { - // Errors mean we should stop. - return NULL; - } - // FIXME: When we can execute static expressions without running the target, we should check that here, - // and return something to indicate we should stop or just continue. - - ThreadPlan *new_plan = new ThreadPlanTestCondition (exe_ctx.GetThreadRef(), - exe_ctx, - m_condition_ap.get(), - break_loc_sp, - true); - - return new_plan; -} - const char * BreakpointOptions::GetConditionText () const { diff --git a/lldb/source/Target/ThreadPlanTestCondition.cpp b/lldb/source/Target/ThreadPlanTestCondition.cpp deleted file mode 100644 index 589d97b74ad..00000000000 --- a/lldb/source/Target/ThreadPlanTestCondition.cpp +++ /dev/null @@ -1,194 +0,0 @@ -//===-- ThreadPlanTestCondition.cpp ---------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "lldb/Target/ThreadPlanTestCondition.h" - -// C Includes -// C++ Includes -// Other libraries and framework includes -// Project includes - -#include "lldb/lldb-private-log.h" -#include "lldb/Breakpoint/Breakpoint.h" -#include "lldb/Breakpoint/BreakpointLocation.h" -#include "lldb/Core/Log.h" -#include "lldb/Core/Stream.h" -#include "lldb/Core/Value.h" -#include "lldb/Core/ValueObject.h" -#include "lldb/Symbol/Function.h" -#include "lldb/Symbol/Symbol.h" -#include "lldb/Target/Process.h" -#include "lldb/Target/RegisterContext.h" -#include "lldb/Target/StopInfo.h" -#include "lldb/Target/Thread.h" - -using namespace lldb; -using namespace lldb_private; - - -//---------------------------------------------------------------------- -// ThreadPlanTestCondition: Step through a stack range, either stepping over or into -// based on the value of \a type. -//---------------------------------------------------------------------- - -ThreadPlanTestCondition::ThreadPlanTestCondition (Thread& thread, - ExecutionContext &exe_ctx, - ClangUserExpression *expression, - const BreakpointLocationSP &break_loc_sp, - bool stop_others) : - ThreadPlan (ThreadPlan::eKindTestCondition, "test condition", thread, eVoteNoOpinion, eVoteNoOpinion), - m_expression (expression), - m_exe_ctx (exe_ctx), - m_break_loc_sp (break_loc_sp), - m_did_stop (false), - m_stop_others (stop_others) -{ -} - -ThreadPlanTestCondition::~ThreadPlanTestCondition () -{ -} - -bool -ThreadPlanTestCondition::ValidatePlan (Stream *error) -{ - return true; -} - -void -ThreadPlanTestCondition::GetDescription (Stream *s, lldb::DescriptionLevel level) -{ - if (m_expression) - s->Printf("Thread plan to test condition: \"%s\".", m_expression->GetUserText()); - else - s->Printf("Thread plan to test unspecified condition."); -} - -bool -ThreadPlanTestCondition::ShouldStop (Event *event_ptr) -{ - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); - if (m_thread.IsThreadPlanDone(m_expression_plan_sp.get())) - { - lldb::ClangExpressionVariableSP expr_result; - StreamString error_stream; - m_expression->FinalizeJITExecution(error_stream, m_exe_ctx, expr_result); - - ValueObjectSP result_sp (expr_result->GetValueObject()); - if (result_sp) - { - // FIXME: This is not the right answer, we should have a "GetValueAsBoolean..." - Scalar scalar_value; - if (result_sp->ResolveValue (scalar_value)) - { - if (scalar_value.ULongLong(1) == 0) - m_did_stop = false; - else - m_did_stop = true; - } - if (log) - log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false"); - } - else - { - if (log) - log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData()); - m_did_stop = true; - } - } - else if (m_exe_ctx.GetThreadRef().WasThreadPlanDiscarded (m_expression_plan_sp.get())) - { - if (log) - log->Printf("ExecuteExpression thread plan was discarded.\n"); - m_did_stop = true; - } - - // One tricky bit, somebody might have disabled/deleted the breakpoint while we were running this condition, if so we - // should just continue. If the breakpoint gets disabled, then its "site" will be null'ed out, so we can't report - // this as a breakpoint event any more, since we can't reconstruct it's site. So just pass the event on. - if (!m_break_loc_sp->IsEnabled()) - { - m_did_stop = false; - } - else - { - // Now we have to change the event to a breakpoint event and mark it up appropriately: - Process::ProcessEventData *new_data = new Process::ProcessEventData (m_thread.GetProcess(), eStateStopped); - event_ptr->SetData(new_data); - event_ptr->SetType(Process::eBroadcastBitStateChanged); - SetStopInfo(StopInfo::CreateStopReasonWithBreakpointSiteID (m_thread, - m_break_loc_sp->GetBreakpointSite()->GetID(), - m_did_stop)); - if (m_did_stop) - { - Process::ProcessEventData::SetRestartedInEvent (event_ptr, false); - } - else - { - Process::ProcessEventData::SetRestartedInEvent (event_ptr, true); - } - } - SetPlanComplete(); - return m_did_stop; -} - -bool -ThreadPlanTestCondition::PlanExplainsStop () -{ - // We explain all stops, and we just can the execution and return true if we stop for any - // reason other than that our expression execution is done. - return true; -} - -Vote -ThreadPlanTestCondition::ShouldReportStop (Event *event_ptr) -{ - if (m_did_stop) - { - return eVoteYes; - } - else - { - return eVoteNo; - } -} - -void -ThreadPlanTestCondition::DidPush() -{ - StreamString error_stream; - m_expression_plan_sp.reset(m_expression->GetThreadPlanToExecuteJITExpression (error_stream, m_exe_ctx)); - m_thread.QueueThreadPlan (m_expression_plan_sp, false); -} - -bool -ThreadPlanTestCondition::StopOthers () -{ - return m_stop_others; -} - -bool -ThreadPlanTestCondition::WillStop () -{ - return true; -} - -StateType -ThreadPlanTestCondition::GetPlanRunState () -{ - return eStateRunning; -} - -bool -ThreadPlanTestCondition::MischiefManaged () -{ - // If we get a stop we're done, we don't puase in the middle of - // condition execution. - return true; -} |