[Lldb-commits] [lldb] r121996 - in /lldb/trunk: include/lldb/Target/Process.h source/Target/Process.cpp
Greg Clayton
gclayton at apple.com
Thu Dec 16 12:01:20 PST 2010
Author: gclayton
Date: Thu Dec 16 14:01:20 2010
New Revision: 121996
URL: http://llvm.org/viewvc/llvm-project?rev=121996&view=rev
Log:
Added the ability to read unsigned integers from the Process:
uint64_t Process::ReadUnsignedInteger (addr_t addr, size_t int_byte_size, Error &error);
Modified:
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/source/Target/Process.cpp
Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=121996&r1=121995&r2=121996&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Thu Dec 16 14:01:20 2010
@@ -1336,6 +1336,10 @@
size_t size,
Error &error);
+ uint64_t
+ ReadUnsignedInteger (lldb::addr_t vm_addr,
+ size_t integer_byte_size,
+ Error &error);
//------------------------------------------------------------------
/// Actually do the writing of memory to a process.
///
Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=121996&r1=121995&r2=121996&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Thu Dec 16 14:01:20 2010
@@ -1072,6 +1072,29 @@
return bytes_read;
}
+uint64_t
+Process::ReadUnsignedInteger (lldb::addr_t vm_addr, size_t integer_byte_size, Error &error)
+{
+ if (integer_byte_size > sizeof(uint64_t))
+ {
+ error.SetErrorString ("unsupported integer size");
+ }
+ else
+ {
+ uint8_t tmp[sizeof(uint64_t)];
+ DataExtractor data (tmp, integer_byte_size, GetByteOrder(), GetAddressByteSize());
+ if (ReadMemory (vm_addr, tmp, integer_byte_size, error) == integer_byte_size)
+ {
+ uint32_t offset = 0;
+ return data.GetMaxU64 (&offset, integer_byte_size);
+ }
+ }
+ // Any plug-in that doesn't return success a memory read with the number
+ // of bytes that were requested should be setting the error
+ assert (error.Fail());
+ return 0;
+}
+
size_t
Process::WriteMemoryPrivate (addr_t addr, const void *buf, size_t size, Error &error)
{
More information about the lldb-commits
mailing list