[Lldb-commits] [lldb] r128917 - in /lldb/trunk: include/lldb/Core/EmulateInstruction.h source/Core/EmulateInstruction.cpp

Caroline Tice ctice at apple.com
Tue Apr 5 13:18:48 PDT 2011


Author: ctice
Date: Tue Apr  5 15:18:48 2011
New Revision: 128917

URL: http://llvm.org/viewvc/llvm-project?rev=128917&view=rev
Log:

Convert "process" read/write callback functions to "frame" read/write callback functions.


Modified:
    lldb/trunk/include/lldb/Core/EmulateInstruction.h
    lldb/trunk/source/Core/EmulateInstruction.cpp

Modified: lldb/trunk/include/lldb/Core/EmulateInstruction.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/EmulateInstruction.h?rev=128917&r1=128916&r2=128917&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/EmulateInstruction.h (original)
+++ lldb/trunk/include/lldb/Core/EmulateInstruction.h Tue Apr  5 15:18:48 2011
@@ -460,32 +460,32 @@
 
 
     static size_t 
-    ReadMemoryProcess (void *baton,
-                       const Context &context, 
-                       lldb::addr_t addr, 
-                       void *dst,
-                       size_t length);
+    ReadMemoryFrame (void *baton,
+                     const Context &context, 
+                     lldb::addr_t addr, 
+                     void *dst,
+                     size_t length);
     
     static size_t 
-    WriteMemoryProcess (void *baton,
-                        const Context &context, 
-                        lldb::addr_t addr, 
-                        const void *dst,
-                        size_t length);
+    WriteMemoryFrame (void *baton,
+                      const Context &context, 
+                      lldb::addr_t addr, 
+                      const void *dst,
+                      size_t length);
     
     static bool   
-    ReadRegisterProcess  (void *baton,
-                          uint32_t reg_kind, 
-                          uint32_t reg_num,
-                          uint64_t &reg_value);
+    ReadRegisterFrame  (void *baton,
+                        uint32_t reg_kind, 
+                        uint32_t reg_num,
+                        uint64_t &reg_value);
     
     
     static bool   
-    WriteRegisterProcess (void *baton,
-                          const Context &context, 
-                          uint32_t reg_kind, 
-                          uint32_t reg_num,
-                          uint64_t reg_value);
+    WriteRegisterFrame (void *baton,
+                        const Context &context, 
+                        uint32_t reg_kind, 
+                        uint32_t reg_num,
+                        uint64_t reg_value);
                           
     static size_t 
     ReadMemoryDefault (void *baton,

Modified: lldb/trunk/source/Core/EmulateInstruction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/EmulateInstruction.cpp?rev=128917&r1=128916&r2=128917&view=diff
==============================================================================
--- lldb/trunk/source/Core/EmulateInstruction.cpp (original)
+++ lldb/trunk/source/Core/EmulateInstruction.cpp Tue Apr  5 15:18:48 2011
@@ -206,21 +206,23 @@
 //
 
 size_t 
-EmulateInstruction::ReadMemoryProcess (void *baton,
-                                       const Context &context, 
-                                       lldb::addr_t addr, 
-                                       void *dst,
-                                       size_t length)
+EmulateInstruction::ReadMemoryFrame (void *baton,
+                                     const Context &context, 
+                                     lldb::addr_t addr, 
+                                     void *dst,
+                                     size_t length)
 {
-    Process *process = (Process *) baton;
-    
-    if (!process)
+    if (!baton)
         return 0;
     
+    
+    StackFrame *frame = (StackFrame *) baton;
+
     DataBufferSP data_sp (new DataBufferHeap (length, '\0'));
     Error error;
     
-    size_t bytes_read = process->ReadMemory (addr, data_sp->GetBytes(), data_sp->GetByteSize(), error);
+    size_t bytes_read = frame->GetThread().GetProcess().ReadMemory (addr, data_sp->GetBytes(), data_sp->GetByteSize(),
+                                                                    error);
     
     if (bytes_read > 0)
         ((DataBufferHeap *) data_sp.get())->CopyData (dst, length);
@@ -229,17 +231,17 @@
 }
 
 size_t 
-EmulateInstruction::WriteMemoryProcess (void *baton,
-                                        const Context &context, 
-                                        lldb::addr_t addr, 
-                                        const void *dst,
-                                        size_t length)
+EmulateInstruction::WriteMemoryFrame (void *baton,
+                                      const Context &context, 
+                                      lldb::addr_t addr, 
+                                      const void *dst,
+                                      size_t length)
 {
-    Process *process = (Process *) baton;
-    
-    if (!process)
+    if (!baton)
         return 0;
     
+    StackFrame *frame = (StackFrame *) baton;
+
     lldb::DataBufferSP data_sp (new DataBufferHeap (dst, length));
     if (data_sp)
     {
@@ -247,7 +249,8 @@
         if (length > 0)
         {
             Error error;
-            size_t bytes_written = process->WriteMemory (addr, data_sp->GetBytes(), length, error);
+            size_t bytes_written = frame->GetThread().GetProcess().WriteMemory (addr, data_sp->GetBytes(), length, 
+                                                                                error);
             
             return bytes_written;
         }
@@ -257,17 +260,16 @@
 }
 
 bool   
-EmulateInstruction::ReadRegisterProcess  (void *baton,
-                                          uint32_t reg_kind, 
-                                          uint32_t reg_num,
-                                          uint64_t &reg_value)
+EmulateInstruction::ReadRegisterFrame  (void *baton,
+                                        uint32_t reg_kind, 
+                                        uint32_t reg_num,
+                                        uint64_t &reg_value)
 {
-    Process *process = (Process *) baton;
-    if (!process)
+    if (!baton)
         return false;
         
-    Thread *thread = process->CalculateThread ();
-    RegisterContext *reg_context = thread->GetRegisterContext().get();
+    StackFrame *frame = (StackFrame *) baton;
+    RegisterContext *reg_context = frame->GetRegisterContext().get();
     Scalar value;
     
     
@@ -281,15 +283,17 @@
 }
 
 bool   
-EmulateInstruction::WriteRegisterProcess (void *baton,
-                                          const Context &context, 
-                                          uint32_t reg_kind, 
-                                          uint32_t reg_num,
-                                          uint64_t reg_value)
+EmulateInstruction::WriteRegisterFrame (void *baton,
+                                        const Context &context, 
+                                        uint32_t reg_kind, 
+                                        uint32_t reg_num,
+                                        uint64_t reg_value)
 {
-    Process *process = (Process *) baton;
-    Thread *thread = process->CalculateThread ();
-    RegisterContext *reg_context = thread->GetRegisterContext().get();
+    if (!baton)
+        return false;
+        
+    StackFrame *frame = (StackFrame *) baton;
+    RegisterContext *reg_context = frame->GetRegisterContext().get();
     Scalar value (reg_value);
     
     return reg_context->WriteRegisterValue (reg_num, value);





More information about the lldb-commits mailing list