From c5041918dda38fbb480ce73da2784ae4765171d3 Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Sat, 25 Aug 2012 00:29:07 +0000 Subject: Added SBDebugger's log callbacks to Python-land - Tweaked a parameter name in SBDebugger.h so my typemap will catch it; - Added a SBDebugger.Create(bool, callback, baton) to the swig interface; - Added SBDebugger.SetLoggingCallback to the swig interface; - Added a callback utility function for log callbacks; - Guard against Py_None on both callback utility functions; - Added a FIXME to the SBDebugger API test; - Added a __del__() stub for SBDebugger. We need to be able to get both the log callback and baton from an SBDebugger if we want to protect against memory leaks (or make the user responsible for holding another reference to the callback). Additionally, it's impossible to revert from a callback-backed log mechanism to a file-backed log mechanism. llvm-svn: 162633 --- lldb/scripts/Python/python-extensions.swig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lldb/scripts/Python/python-extensions.swig') diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig index 24f06a1..da70f20 100644 --- a/lldb/scripts/Python/python-extensions.swig +++ b/lldb/scripts/Python/python-extensions.swig @@ -484,6 +484,15 @@ } } + +// %extend lldb::SBDebugger { +// // FIXME: We can't get the callback and baton +// PyObject *lldb::SBDebugger (){ +// // Only call Py_XDECREF if we have a Python object (or NULL) +// if (LLDBSwigPythonCallPythonLogOutputCallback == $self->GetLogOutPutCallback()) +// Py_XDECREF($self->GetCallbackBaton()); +// } +// } // %extend lldb::SBInputReader { // // FIXME: m_callback_function is private and we have no other // // way to access it. @@ -686,4 +695,3 @@ class value(object): def __neq__(self, other): return not self.__eq__(other) %} - -- cgit v1.1