[Lldb-commits] [lldb] r162204 - in /lldb/trunk: include/lldb/API/SBDebugger.h scripts/Python/interface/SBDebugger.i scripts/Python/python-typemaps.swig source/API/SBDebugger.cpp test/python_api/default-constructor/sb_debugger.py

Filipe Cabecinhas me at filcab.net
Mon Aug 20 09:21:04 PDT 2012


Author: filcab
Date: Mon Aug 20 11:21:04 2012
New Revision: 162204

URL: http://llvm.org/viewvc/llvm-project?rev=162204&view=rev
Log:
A baton isn't needed to dispatch input.

I also added a typemap to make DispatchInput usable in Python.

Modified:
    lldb/trunk/include/lldb/API/SBDebugger.h
    lldb/trunk/scripts/Python/interface/SBDebugger.i
    lldb/trunk/scripts/Python/python-typemaps.swig
    lldb/trunk/source/API/SBDebugger.cpp
    lldb/trunk/test/python_api/default-constructor/sb_debugger.py

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=162204&r1=162203&r2=162204&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Mon Aug 20 11:21:04 2012
@@ -194,7 +194,7 @@
     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 ();

Modified: lldb/trunk/scripts/Python/interface/SBDebugger.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBDebugger.i?rev=162204&r1=162203&r2=162204&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBDebugger.i (original)
+++ lldb/trunk/scripts/Python/interface/SBDebugger.i Mon Aug 20 11:21:04 2012
@@ -272,7 +272,7 @@
     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 ();

Modified: lldb/trunk/scripts/Python/python-typemaps.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-typemaps.swig?rev=162204&r1=162203&r2=162204&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-typemaps.swig (original)
+++ lldb/trunk/scripts/Python/python-typemaps.swig Mon Aug 20 11:21:04 2012
@@ -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) {

Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=162204&r1=162203&r2=162204&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Mon Aug 20 11:21:04 2012
@@ -794,13 +794,13 @@
 }
 
 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);

Modified: lldb/trunk/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/default-constructor/sb_debugger.py?rev=162204&r1=162203&r2=162204&view=diff
==============================================================================
--- lldb/trunk/test/python_api/default-constructor/sb_debugger.py (original)
+++ lldb/trunk/test/python_api/default-constructor/sb_debugger.py Mon Aug 20 11:21:04 2012
@@ -32,7 +32,7 @@
     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())





More information about the lldb-commits mailing list