[Lldb-commits] [lldb] r155967 - in /lldb/trunk: include/lldb/Breakpoint/Breakpoint.h include/lldb/Breakpoint/BreakpointLocation.h include/lldb/Breakpoint/BreakpointOptions.h include/lldb/Target/ThreadPlanTestCondition.h source/Breakpoint/Breakpoint.cpp source/Breakpoint/BreakpointLocation.cpp source/Breakpoint/BreakpointOptions.cpp source/Target/ThreadPlanTestCondition.cpp

Jim Ingham jingham at apple.com
Tue May 1 17:23:18 PDT 2012


Author: jingham
Date: Tue May  1 19:23:18 2012
New Revision: 155967

URL: http://llvm.org/viewvc/llvm-project?rev=155967&view=rev
Log:
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.

Removed:
    lldb/trunk/include/lldb/Target/ThreadPlanTestCondition.h
    lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
Modified:
    lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
    lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
    lldb/trunk/source/Breakpoint/Breakpoint.cpp
    lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
    lldb/trunk/source/Breakpoint/BreakpointOptions.cpp

Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue May  1 19:23:18 2012
@@ -412,25 +412,6 @@
     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

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointLocation.h Tue May  1 19:23:18 2012
@@ -167,23 +167,7 @@
     //------------------------------------------------------------------
     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.
     ///

Modified: lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/BreakpointOptions.h Tue May  1 19:23:18 2012
@@ -177,25 +177,6 @@
     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

Removed: lldb/trunk/include/lldb/Target/ThreadPlanTestCondition.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanTestCondition.h?rev=155966&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanTestCondition.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanTestCondition.h (removed)
@@ -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_

Modified: lldb/trunk/source/Breakpoint/Breakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Breakpoint.cpp?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Breakpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Breakpoint.cpp Tue May  1 19:23:18 2012
@@ -247,12 +247,6 @@
     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
 {

Modified: lldb/trunk/source/Breakpoint/BreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointLocation.cpp?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointLocation.cpp Tue May  1 19:23:18 2012
@@ -235,15 +235,6 @@
     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
 {

Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=155967&r1=155966&r2=155967&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Tue May  1 19:23:18 2012
@@ -170,51 +170,6 @@
     }
 }
 
-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
 {

Removed: lldb/trunk/source/Target/ThreadPlanTestCondition.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanTestCondition.cpp?rev=155966&view=auto
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanTestCondition.cpp (removed)
@@ -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;
-}





More information about the lldb-commits mailing list