diff options
| author | Caroline Tice <ctice@apple.com> | 2011-04-05 20:18:48 +0000 |
|---|---|---|
| committer | Caroline Tice <ctice@apple.com> | 2011-04-05 20:18:48 +0000 |
| commit | 3d50b2f7a6e682e6a58bf32f09cf46c8092a3fa0 (patch) | |
| tree | 0ba0b60faeb796a69713d91e4f7f558302c0703f | |
| parent | de909e4946a439a15f2dfd9bd6978c4b5b519311 (diff) | |
| download | bcm5719-llvm-3d50b2f7a6e682e6a58bf32f09cf46c8092a3fa0.tar.gz bcm5719-llvm-3d50b2f7a6e682e6a58bf32f09cf46c8092a3fa0.zip | |
Convert "process" read/write callback functions to "frame" read/write callback functions.
llvm-svn: 128917
| -rw-r--r-- | lldb/include/lldb/Core/EmulateInstruction.h | 38 | ||||
| -rw-r--r-- | lldb/source/Core/EmulateInstruction.cpp | 72 |
2 files changed, 57 insertions, 53 deletions
diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h index 96c1df4abe1..2e8bccb2ef4 100644 --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -460,32 +460,32 @@ public: 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 ®_value); + ReadRegisterFrame (void *baton, + uint32_t reg_kind, + uint32_t reg_num, + uint64_t ®_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, diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index f67e3505981..93c2bcc0706 100644 --- a/lldb/source/Core/EmulateInstruction.cpp +++ b/lldb/source/Core/EmulateInstruction.cpp @@ -206,21 +206,23 @@ EmulateInstruction::SetWriteRegCallback (WriteRegister write_reg_callback) // 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 @@ EmulateInstruction::ReadMemoryProcess (void *baton, } 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 @@ EmulateInstruction::WriteMemoryProcess (void *baton, 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 @@ EmulateInstruction::WriteMemoryProcess (void *baton, } bool -EmulateInstruction::ReadRegisterProcess (void *baton, - uint32_t reg_kind, - uint32_t reg_num, - uint64_t ®_value) +EmulateInstruction::ReadRegisterFrame (void *baton, + uint32_t reg_kind, + uint32_t reg_num, + uint64_t ®_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 @@ EmulateInstruction::ReadRegisterProcess (void *baton, } 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); |

