From 7d1f93942ffbd4d36ad2e620618a9fea5b37c808 Mon Sep 17 00:00:00 2001 From: Enrico Granata Date: Sat, 23 Mar 2013 01:35:44 +0000 Subject: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Exports write() and flush() from SBCommandReturnObject to enable file-like output from Python commands. e.g.: def ls(debugger, command, result, internal_dict): print >>result,”just “some output” will produce (lldb) ls just “some output (lldb) llvm-svn: 177807 --- lldb/scripts/Python/python-extensions.swig | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lldb/scripts/Python') diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 89ad1b29e1c..84c719c6364 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -68,6 +68,13 @@ else return PyString_FromString(""); } + void lldb::SBCommandReturnObject::write (const char* str) + { + if (str) + $self->Printf("%s",str); + } + void lldb::SBCommandReturnObject::flush () + {} } %extend lldb::SBCompileUnit { PyObject *lldb::SBCompileUnit::__str__ (){ -- cgit v1.2.3