summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/python-extensions.swig
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts/Python/python-extensions.swig')
-rw-r--r--lldb/scripts/Python/python-extensions.swig20
1 files changed, 20 insertions, 0 deletions
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig
index 84c719c6364..29eae6d331c 100644
--- a/lldb/scripts/Python/python-extensions.swig
+++ b/lldb/scripts/Python/python-extensions.swig
@@ -68,6 +68,12 @@
else
return PyString_FromString("");
}
+
+ /* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage
+ they are meant to make an SBCommandReturnObject into a file-like object so that instructions of the sort
+ print >>sb_command_return_object, "something"
+ will work correctly */
+
void lldb::SBCommandReturnObject::write (const char* str)
{
if (str)
@@ -272,6 +278,20 @@
return PyString_FromString("");
}
}
+%extend lldb::SBStream {
+ /* the write() and flush() calls are not part of the SB API proper, and are solely for Python usage
+ they are meant to make an SBStream into a file-like object so that instructions of the sort
+ print >>sb_stream, "something"
+ will work correctly */
+
+ void lldb::SBStream::write (const char* str)
+ {
+ if (str)
+ $self->Printf("%s",str);
+ }
+ void lldb::SBStream::flush ()
+ {}
+}
%extend lldb::SBSymbol {
PyObject *lldb::SBSymbol::__str__ (){
lldb::SBStream description;
OpenPOWER on IntegriCloud