[Lldb-commits] [lldb] r118871 - in /lldb/trunk: include/lldb/Target/ABI.h include/lldb/Target/Thread.h include/lldb/Target/ThreadPlanCallFunction.h source/Target/Thread.cpp source/Target/ThreadPlanCallFunction.cpp

Sean Callanan scallanan at apple.com
Thu Nov 11 17:37:02 PST 2010


Author: spyffe
Date: Thu Nov 11 19:37:02 2010
New Revision: 118871

URL: http://llvm.org/viewvc/llvm-project?rev=118871&view=rev
Log:
Excised a version of the low-level function calling
logic that supported calling functions with arbitrary
arguments.  We use ClangFunction for this, and the
low-level logic is only required to support one or two
pointer arguments.

Modified:
    lldb/trunk/include/lldb/Target/ABI.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/source/Target/ThreadPlanCallFunction.cpp

Modified: lldb/trunk/include/lldb/Target/ABI.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ABI.h?rev=118871&r1=118870&r2=118871&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ABI.h (original)
+++ lldb/trunk/include/lldb/Target/ABI.h Thu Nov 11 19:37:02 2010
@@ -38,13 +38,6 @@
                         lldb::addr_t *this_arg) const = 0;
     
     virtual bool
-    PrepareNormalCall (Thread &thread,
-                       lldb::addr_t sp,
-                       lldb::addr_t functionAddress,
-                       lldb::addr_t returnAddress,
-                       ValueList &args) const = 0;
-    
-    virtual bool
     GetArgumentValues (Thread &thread,
                        ValueList &values) const = 0;
     

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=118871&r1=118870&r2=118871&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Thu Nov 11 19:37:02 2010
@@ -492,13 +492,6 @@
                                     lldb::addr_t arg,
                                     bool stop_other_threads,
                                     bool discard_on_error = false);
-    
-    virtual ThreadPlan *
-    QueueThreadPlanForCallFunction (bool abort_other_plans,
-                                    Address& function,
-                                    ValueList &args,
-                                    bool stop_other_threads,
-                                    bool discard_on_error = false);
                                             
     //------------------------------------------------------------------
     // Thread Plan accessors:

Modified: lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h?rev=118871&r1=118870&r2=118871&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadPlanCallFunction.h Thu Nov 11 19:37:02 2010
@@ -30,12 +30,6 @@
                             bool discard_on_error = true,
                             lldb::addr_t *this_arg = 0);
     
-    ThreadPlanCallFunction (Thread &thread,
-                            Address &function,
-                            ValueList &args,
-                            bool stop_other_threads,
-                            bool discard_on_error = true);
-    
     virtual
     ~ThreadPlanCallFunction ();
 

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=118871&r1=118870&r2=118871&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Thu Nov 11 19:37:02 2010
@@ -726,18 +726,6 @@
 }
 
 ThreadPlan *
-Thread::QueueThreadPlanForCallFunction (bool abort_other_plans,
-                                        Address& function,
-                                        ValueList &args,
-                                        bool stop_other_threads,
-                                        bool discard_on_error)
-{
-    ThreadPlanSP thread_plan_sp (new ThreadPlanCallFunction (*this, function, args, stop_other_threads, discard_on_error));
-    QueueThreadPlan (thread_plan_sp, abort_other_plans);
-    return thread_plan_sp.get();
-}
-
-ThreadPlan *
 Thread::QueueThreadPlanForRunToAddress (bool abort_other_plans,
                                         Address &target_addr,
                                         bool stop_other_threads)

Modified: lldb/trunk/source/Target/ThreadPlanCallFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanCallFunction.cpp?rev=118871&r1=118870&r2=118871&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanCallFunction.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanCallFunction.cpp Thu Nov 11 19:37:02 2010
@@ -111,81 +111,6 @@
     m_valid = true;    
 }
 
-ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
-                                                Address &function,
-                                                ValueList &args,
-                                                bool stop_other_threads,
-                                                bool discard_on_error) :
-    ThreadPlan (ThreadPlan::eKindCallFunction, "Call function plan", thread, eVoteNoOpinion, eVoteNoOpinion),
-    m_valid (false),
-    m_stop_other_threads (stop_other_threads),
-    m_arg_addr (0),
-    m_args (&args),
-    m_process (thread.GetProcess()),
-    m_thread (thread)
-{
-    
-    SetOkayToDiscard (discard_on_error);
-    
-    Process& process = thread.GetProcess();
-    Target& target = process.GetTarget();
-    const ABI *abi = process.GetABI();
-    
-    if(!abi)
-        return;
-    
-    SetBreakpoints();
-    
-    lldb::addr_t spBelowRedZone = thread.GetRegisterContext()->GetSP() - abi->GetRedZoneSize();
-    
-    SymbolContextList contexts;
-    SymbolContext context;
-    ModuleSP executableModuleSP (target.GetExecutableModule());
-    
-    if (!executableModuleSP ||
-        !executableModuleSP->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts))
-        return;
-    
-    contexts.GetContextAtIndex(0, context);
-    
-    m_start_addr = context.symbol->GetValue();
-    lldb::addr_t StartLoadAddr = m_start_addr.GetLoadAddress(&target);
-    
-    if(!thread.SaveFrameZeroState(m_register_backup))
-        return;
-    
-    m_function_addr = function;
-    lldb::addr_t FunctionLoadAddr = m_function_addr.GetLoadAddress(&target);
-    
-    if (!abi->PrepareNormalCall(thread, 
-                                spBelowRedZone, 
-                                FunctionLoadAddr, 
-                                StartLoadAddr, 
-                                *m_args))
-        return;
-    
-    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
-    
-    if (log)
-    {
-        RegisterContext *reg_ctx = m_thread.GetRegisterContext();
-        
-        log->PutCString("Function call was set up.  Register state was:");
-        
-        for (uint32_t register_index = 0, num_registers = reg_ctx->GetRegisterCount();
-             register_index < num_registers;
-             ++register_index)
-        {
-            const char *register_name = reg_ctx->GetRegisterName(register_index);
-            uint64_t register_value = reg_ctx->ReadRegisterAsUnsigned(register_index, LLDB_INVALID_ADDRESS);
-            
-            log->Printf("  %s = 0x%llx", register_name, register_value);
-        }
-    }
-    
-    m_valid = true;    
-}
-
 ThreadPlanCallFunction::~ThreadPlanCallFunction ()
 {
     if (m_valid && !IsPlanComplete())





More information about the lldb-commits mailing list