summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python')
-rw-r--r--lldb/scripts/Python/python-typemaps.swig21
1 files changed, 16 insertions, 5 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig
index 9921c485162..ec9302a15cd 100644
--- a/lldb/scripts/Python/python-typemaps.swig
+++ b/lldb/scripts/Python/python-typemaps.swig
@@ -151,8 +151,14 @@
// See also SBThread::GetStopDescription.
%typemap(argout) (char *dst, size_t dst_len) {
Py_XDECREF($result); /* Blow away any previous result */
- lldb_private::PythonString str($1);
- $result = str.release();
+ if (result == 0) {
+ $result = Py_None;
+ Py_INCREF($result);
+ } else {
+ llvm::StringRef ref(static_cast<const char*>($1), result);
+ lldb_private::PythonString string(ref);
+ $result = string.release();
+ }
free($1);
}
@@ -242,9 +248,14 @@
// See also SBProcess::ReadMemory.
%typemap(argout) (void *buf, size_t size) {
Py_XDECREF($result); /* Blow away any previous result */
- llvm::StringRef ref(static_cast<const char*>($1), result);
- lldb_private::PythonString string(ref);
- $result = string.release();
+ if (result == 0) {
+ $result = Py_None;
+ Py_INCREF($result);
+ } else {
+ llvm::StringRef ref(static_cast<const char*>($1), result);
+ lldb_private::PythonString string(ref);
+ $result = string.release();
+ }
free($1);
}
OpenPOWER on IntegriCloud