summaryrefslogtreecommitdiffstats
path: root/lldb/scripts/Python/python-extensions.swig
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2013-03-25 17:37:39 +0000
committerEnrico Granata <egranata@apple.com>2013-03-25 17:37:39 +0000
commitceba071330ec0004d5d44cdb0ba9728df231c223 (patch)
treee67043d513f9fe2bf568d74840f0c0e8bfbfdcf3 /lldb/scripts/Python/python-extensions.swig
parent51cb2fa1c3e867eef7df91135d56d33dded0fb39 (diff)
downloadbcm5719-llvm-ceba071330ec0004d5d44cdb0ba9728df231c223.tar.gz
bcm5719-llvm-ceba071330ec0004d5d44cdb0ba9728df231c223.zip
- Masking out SBCommandReturnObject::Printf() from the Python layer because SWIG and varargs do not get along well.
It is replaced by a Print("str") call which is equivalent to Printf("%s","str") - Providing file-like behavior for SBStream with appropriate extension write() and flush() calls, plus documenting that these are only meant and only exist for Python Documenting the file-like behavior on our website llvm-svn: 177877
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