summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/interface/SBProcess.i
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-12-15 03:14:23 +0000
committerGreg Clayton <gclayton@apple.com>2011-12-15 03:14:23 +0000
commite91b7957b2d4ea2c880b303e543c711566cb7cd0 (patch)
tree976f5ea578018c47413a4e9382485ef863476505 /lldb/scripts/Python/interface/SBProcess.i
parent2c74eedbba4c278635345d7de58a02c3f9f36f07 (diff)
downloadbcm5719-llvm-e91b7957b2d4ea2c880b303e543c711566cb7cd0.tar.gz
bcm5719-llvm-e91b7957b2d4ea2c880b303e543c711566cb7cd0.zip
Expose new read memory fucntion through python in SBProcess:
size_t SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error); uint64_t SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error); lldb::addr_t SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &error); These ReadCStringFromMemory() has some SWIG type magic that makes it return the python string directly and the "buf" is not needed: error = SBError() max_cstr_len = 256 cstr = lldb.process.ReadCStringFromMemory (0x1000, max_cstr_len, error) if error.Success(): .... The other two functions behave as expteced. This will make it easier to get integer values from the inferior process that are correctly byte swapped. Also for pointers, the correct pointer byte size will be used. Also cleaned up a few printf style warnings for the 32 bit lldb build on darwin. llvm-svn: 146636
Diffstat (limited to 'lldb/scripts/Python/interface/SBProcess.i')
-rw-r--r--lldb/scripts/Python/interface/SBProcess.i51
1 files changed, 51 insertions, 0 deletions
diff --git a/lldb/scripts/Python/interface/SBProcess.i b/lldb/scripts/Python/interface/SBProcess.i
index b2ab9231a26..920aefb4c80 100644
--- a/lldb/scripts/Python/interface/SBProcess.i
+++ b/lldb/scripts/Python/interface/SBProcess.i
@@ -208,6 +208,57 @@ public:
size_t
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
+ %feature("autodoc", "
+ Reads a NULL terminated C string from the current process's address space.
+ It returns a python string of the exact length, or truncates the string if
+ the maximum character limit is reached. Example:
+
+ # Read a C string of at most 256 bytes from address '0x1000'
+ error = lldb.SBError()
+ cstring = process.ReadMemory(0x1000, 256, error)
+ if error.Success():
+ print 'cstring: ', cstring
+ else
+ print 'error: ', error
+ ") ReadCStringFromMemory;
+
+ size_t
+ ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
+
+ %feature("autodoc", "
+ Reads an unsigned integer from memory given a byte size and an address.
+ Returns the unsigned integer that was read. Example:
+
+ # Read a 4 byte unsigned integer from address 0x1000
+ error = lldb.SBError()
+ uint = ReadUnsignedFromMemory(0x1000, 4, error)
+ if error.Success():
+ print 'integer: %u' % uint
+ else
+ print 'error: ', error
+
+ ") ReadUnsignedFromMemory;
+
+ uint64_t
+ ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
+
+ %feature("autodoc", "
+ Reads a pointer from memory from an address and returns the value. Example:
+
+ # Read a pointer from address 0x1000
+ error = lldb.SBError()
+ ptr = ReadPointerFromMemory(0x1000, error)
+ if error.Success():
+ print 'pointer: 0x%x' % ptr
+ else
+ print 'error: ', error
+
+ ") ReadPointerFromMemory;
+
+ lldb::addr_t
+ ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
+
+
// Events
static lldb::StateType
GetStateFromEvent (const lldb::SBEvent &event);
OpenPOWER on IntegriCloud