From c30199917ad4e32229df70367cedabd2bc2b334b Mon Sep 17 00:00:00 2001 From: Filipe Cabecinhas Date: Mon, 20 Aug 2012 16:21:04 +0000 Subject: A baton isn't needed to dispatch input. I also added a typemap to make DispatchInput usable in Python. llvm-svn: 162204 --- lldb/scripts/Python/interface/SBDebugger.i | 2 +- lldb/scripts/Python/python-typemaps.swig | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'lldb/scripts/Python') diff --git a/lldb/scripts/Python/interface/SBDebugger.i b/lldb/scripts/Python/interface/SBDebugger.i index 2fabc452fb9..883ed1c5fb5 100644 --- a/lldb/scripts/Python/interface/SBDebugger.i +++ b/lldb/scripts/Python/interface/SBDebugger.i @@ -272,7 +272,7 @@ public: EnableLog (const char *channel, const char ** types); void - DispatchInput (void *baton, const void *data, size_t data_len); + DispatchInput (const void *data, size_t data_len); void DispatchInputInterrupt (); diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig index 1c3fbbb7c79..31364cac84e 100644 --- a/lldb/scripts/Python/python-typemaps.swig +++ b/lldb/scripts/Python/python-typemaps.swig @@ -113,6 +113,22 @@ } } +// For SBDebugger::DispatchInput +%typemap(in) (const void *data, size_t data_len) { + if (PyString_Check($input)) { + $1 = static_cast(PyString_AsString($input)); + $2 = PyString_Size($input); + } + else if(PyByteArray_Check($input)) { + $1 = static_cast(PyByteArray_AsString($input)); + $2 = PyByteArray_Size($input); + } + else { + PyErr_SetString(PyExc_ValueError, "Expecting a string or byte array"); + return NULL; + } +} + // typemap for an incoming buffer // See also SBProcess::ReadMemory. %typemap(in) (void *buf, size_t size) { -- cgit v1.2.3