diff options
-rw-r--r-- | lldb/include/lldb/API/SBDebugger.h | 2 | ||||
-rw-r--r-- | lldb/scripts/Python/interface/SBDebugger.i | 2 | ||||
-rw-r--r-- | lldb/scripts/Python/python-typemaps.swig | 16 | ||||
-rw-r--r-- | lldb/source/API/SBDebugger.cpp | 6 | ||||
-rw-r--r-- | lldb/test/python_api/default-constructor/sb_debugger.py | 2 |
5 files changed, 22 insertions, 6 deletions
diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index a07c764bc94..36f71a00b57 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -194,7 +194,7 @@ public: SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton); 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/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<void *>(PyString_AsString($input)); + $2 = PyString_Size($input); + } + else if(PyByteArray_Check($input)) { + $1 = static_cast<void *>(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) { diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index c5574d0d019..9ca012f07a9 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -794,13 +794,13 @@ SBDebugger::SetSelectedTarget (SBTarget &sb_target) } void -SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) +SBDebugger::DispatchInput (const void *data, size_t data_len) { LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) - log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(), - baton, (int) data_len, (const char *) data, data_len); + log->Printf ("SBDebugger(%p)::DispatchInput (data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(), + (int) data_len, (const char *) data, data_len); if (m_opaque_sp) m_opaque_sp->DispatchInput ((const char *) data, data_len); diff --git a/lldb/test/python_api/default-constructor/sb_debugger.py b/lldb/test/python_api/default-constructor/sb_debugger.py index e5cdf2ce4b5..fb52c4877ce 100644 --- a/lldb/test/python_api/default-constructor/sb_debugger.py +++ b/lldb/test/python_api/default-constructor/sb_debugger.py @@ -32,7 +32,7 @@ def fuzz_obj(obj): obj.GetSourceManager() obj.SetSelectedTarget(lldb.SBTarget()) obj.SetCurrentPlatformSDKRoot("tmp/sdk-root") - obj.DispatchInput(None, None, 0) + obj.DispatchInput(None, 0) obj.DispatchInputInterrupt() obj.DispatchInputEndOfFile() obj.PushInputReader(lldb.SBInputReader()) |