Add TestProcessAPI.py which exercises some Python SBProcess API. In particular, this tests
the SBProcess.ReadMemory() API, which, due to SWIG typemap'ing, expects 3 arguments (the location
to read from, the size in bytes to read, and an SBError object), and returns the result as a
Python string object.
On SnowLeopard where this has been tested, the SWIG script needs to be pampered (use the exact
same parameter names as in SBProcess.h) in order for this to work.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@126736 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/scripts/lldb.swig b/scripts/lldb.swig
index 5a8a88e..752be40 100644
--- a/scripts/lldb.swig
+++ b/scripts/lldb.swig
@@ -56,7 +56,7 @@
// typemap for an outgoing buffer
-%typemap(in) (const void *wbuffer, size_t len) {
+%typemap(in) (const void *buf, size_t size) {
if (!PyString_Check($input)) {
PyErr_SetString(PyExc_ValueError, "Expecting a string");
return NULL;
@@ -66,7 +66,7 @@
}
// typemap for an incoming buffer
-%typemap(in) (void *rbuffer, size_t len) {
+%typemap(in) (void *buf, size_t size) {
if (!PyInt_Check($input)) {
PyErr_SetString(PyExc_ValueError, "Expecting an integer");
return NULL;
@@ -80,14 +80,14 @@
}
// Return the buffer. Discarding any previous return result
-%typemap(argout) (void *rbuffer, size_t len) {
+%typemap(argout) (void *buf, size_t size) {
Py_XDECREF($result); /* Blow away any previous result */
if (result < 0) { /* Check for I/O error */
free($1);
PyErr_SetFromErrno(PyExc_IOError);
return NULL;
}
- $result = PyString_FromStringAndSize($1,result);
+ $result = PyString_FromStringAndSize(static_cast<const char*>($1),result);
free($1);
}