summaryrefslogtreecommitdiffstats
path: root/lldb/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/scripts')
-rw-r--r--lldb/scripts/Python/interface/SBCommandReturnObject.i7
-rw-r--r--lldb/scripts/Python/python-wrapper.swig10
-rw-r--r--lldb/scripts/lldb.swig19
3 files changed, 32 insertions, 4 deletions
diff --git a/lldb/scripts/Python/interface/SBCommandReturnObject.i b/lldb/scripts/Python/interface/SBCommandReturnObject.i
index 48d7bc24554..51d8ca8a77f 100644
--- a/lldb/scripts/Python/interface/SBCommandReturnObject.i
+++ b/lldb/scripts/Python/interface/SBCommandReturnObject.i
@@ -70,6 +70,13 @@ public:
void
SetImmediateErrorFile (FILE *fh);
+
+ void
+ PutCString(const char* string, int len = -1);
+
+ size_t
+ Printf(const char* format, ...);
+
};
} // namespace lldb
diff --git a/lldb/scripts/Python/python-wrapper.swig b/lldb/scripts/Python/python-wrapper.swig
index 0843af126d1..02691047861 100644
--- a/lldb/scripts/Python/python-wrapper.swig
+++ b/lldb/scripts/Python/python-wrapper.swig
@@ -590,19 +590,21 @@ LLDBSwigPythonCallCommand
lldb::DebuggerSP& debugger,
const char* args,
std::string& err_msg,
- lldb::SBStream& stream
+ lldb_private::CommandReturnObject& cmd_retobj
)
{
+ not_owning_ap<lldb_private::CommandReturnObject> auto_cmd_retobj(&cmd_retobj);
+
bool retval = false;
PyObject *DebuggerObj_PyObj = SWIG_NewPointerObj((void *) &debugger, SWIGTYPE_p_lldb__SBDebugger, 0);
- PyObject *StreamObj_PyObj = SWIG_NewPointerObj((void *) &stream, SWIGTYPE_p_lldb__SBStream, 0);
+ PyObject *CmdRetObj_PyObj = SWIG_NewPointerObj((void *) &auto_cmd_retobj, SWIGTYPE_p_lldb__SBCommandReturnObject, 0);
if (DebuggerObj_PyObj == NULL)
return retval;
- if (StreamObj_PyObj == NULL)
+ if (CmdRetObj_PyObj == NULL)
return retval;
if (!python_function_name || !session_dictionary_name)
@@ -676,7 +678,7 @@ LLDBSwigPythonCallCommand
PyTuple_SetItem (pargs, 0, DebuggerObj_PyObj); // This "steals" a reference to DebuggerObj_PyObj
PyTuple_SetItem (pargs, 1, PyString_FromString(args));
- PyTuple_SetItem (pargs, 2, StreamObj_PyObj); // This "steals" a reference to StreamObj_PyObj
+ PyTuple_SetItem (pargs, 2, CmdRetObj_PyObj); // This "steals" a reference to CmdRetObj_PyObj
PyTuple_SetItem (pargs, 3, session_dict); // This "steals" a reference to session_dict
pvalue = PyObject_CallObject (pfunc, pargs);
Py_DECREF (pargs);
diff --git a/lldb/scripts/lldb.swig b/lldb/scripts/lldb.swig
index affbebb935a..8f18bf33fd4 100644
--- a/lldb/scripts/lldb.swig
+++ b/lldb/scripts/lldb.swig
@@ -78,6 +78,25 @@ o SBLineEntry: Specifies an association with a contiguous range of instructions
#include "lldb/API/SBValueList.h"
%}
+%{
+template<class T>
+class not_owning_ap
+{
+private:
+ std::auto_ptr<T> m_auto_ptr;
+public:
+ explicit not_owning_ap (T* p=0) : m_auto_ptr(p) {}
+ not_owning_ap (not_owning_ap& a) : m_auto_ptr(a.m_auto_ptr) {}
+ template<class Y>
+ not_owning_ap (not_owning_ap<Y>& a) : m_auto_ptr(a.m_auto_ptr) {}
+ not_owning_ap (const not_owning_ap<T>& r) : m_auto_ptr(r.m_auto_ptr) {}
+ ~not_owning_ap() { m_auto_ptr.release(); }
+ T* get() const { return m_auto_ptr.get(); }
+ T& operator*() const { return *m_auto_ptr; }
+ void reset (T* p=0) { m_auto_ptr.release(); m_auto_ptr.reset(p); }
+};
+%}
+
/* Various liblldb typedefs that SWIG needs to know about. */
#define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */
%include <stdint.h>
OpenPOWER on IntegriCloud