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
This commit is contained in:
Filipe Cabecinhas
2012-08-25 00:29:07 +00:00
parent de70e0ef45
commit c5041918dd
6 changed files with 99 additions and 39 deletions

View File

@@ -2,11 +2,10 @@
Test Debugger APIs.
"""
import os, time
import re
import unittest2
import lldb, lldbutil
from lldbtest import *
import os
import lldb
from lldbtest import TestBase, python_api_test
class DebuggerAPITestCase(TestBase):
@@ -25,6 +24,9 @@ class DebuggerAPITestCase(TestBase):
self.dbg.FindTargetWithFileAndArch(None, None)
self.dbg.SetInternalVariable(None, None, None)
self.dbg.GetInternalVariableValue(None, None)
# FIXME (filcab): We must first allow for the swig bindings to know if
# a Python callback is set. (Check python-typemaps.swig)
#self.dbg.SetLoggingCallback(None)
self.dbg.SetPrompt(None)
self.dbg.SetCurrentPlatform(None)
self.dbg.SetCurrentPlatformSDKRoot(None)
@@ -35,4 +37,3 @@ class DebuggerAPITestCase(TestBase):
target = lldb.SBTarget()
self.assertFalse(target.IsValid())
self.dbg.DeleteTarget(target)