Skip to content

Commit 7cff05a

Browse files
committed
Revert "[lldb][api-test] Add API test for SBCommandInterpreter::CommandOverrideCallback (llvm#94518)"
This reverts commit 6fb6eba. This test breaks due to an incorrect import in the test.
1 parent 6fb6eba commit 7cff05a

File tree

4 files changed

+3
-70
lines changed

4 files changed

+3
-70
lines changed

lldb/bindings/python/python-typemaps.swig

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ template <> bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
427427
free($1);
428428
}
429429

430+
430431
// For Log::LogOutputCallback
431432
%typemap(in) (lldb::LogOutputCallback log_callback, void *baton) {
432433
if (!($input == Py_None ||
@@ -475,23 +476,6 @@ template <> bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
475476
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject *>($input));
476477
}
477478

478-
%typemap(in) (lldb::CommandOverrideCallback callback, void *baton) {
479-
if (!($input == Py_None ||
480-
PyCallable_Check(reinterpret_cast<PyObject *>($input)))) {
481-
PyErr_SetString(PyExc_TypeError, "Need a callable object or None!");
482-
SWIG_fail;
483-
}
484-
485-
// Don't lose the callback reference.
486-
Py_INCREF($input);
487-
$1 = LLDBSwigPythonCallPythonSBCommandInterpreterSetCommandOverrideCallback;
488-
$2 = $input;
489-
}
490-
%typemap(typecheck) (lldb::CommandOverrideCallback callback, void *baton) {
491-
$1 = $input == Py_None;
492-
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject *>($input));
493-
}
494-
495479
%typemap(in) lldb::FileSP {
496480
PythonFile py_file(PyRefType::Borrowed, $input);
497481
if (!py_file) {

lldb/bindings/python/python-wrapper.swig

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,28 +1099,6 @@ static void LLDBSwigPythonCallPythonSBDebuggerTerminateCallback(lldb::user_id_t
10991099
}
11001100
}
11011101

1102-
static bool LLDBSwigPythonCallPythonSBCommandInterpreterSetCommandOverrideCallback(void *baton, const char **argv) {
1103-
bool ret_val = false;
1104-
if (baton != Py_None) {
1105-
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1106-
// Create a PyList of items since we're going to pass it to the callback as a tuple
1107-
// of arguments.
1108-
PyObject *py_argv = PyList_New(0);
1109-
for (const char **arg = argv; arg && *arg; arg++) {
1110-
std::string arg_string = *arg;
1111-
PyObject *py_string = PyUnicode_FromStringAndSize(arg_string.c_str(), arg_string.size());
1112-
PyList_Append(py_argv, py_string);
1113-
}
1114-
1115-
PyObject *result = PyObject_CallObject(
1116-
reinterpret_cast<PyObject *>(baton), PyList_AsTuple(py_argv));
1117-
ret_val = result ? PyObject_IsTrue(result) : false;
1118-
Py_XDECREF(result);
1119-
SWIG_PYTHON_THREAD_END_BLOCK;
1120-
}
1121-
return ret_val;
1122-
}
1123-
11241102
static SBError LLDBSwigPythonCallLocateModuleCallback(
11251103
void *callback_baton, const SBModuleSpec &module_spec_sb,
11261104
SBFileSpec &module_file_spec_sb, SBFileSpec &symbol_file_spec_sb) {

lldb/include/lldb/API/SBCommandInterpreter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,11 @@ class SBCommandInterpreter {
265265
// Catch commands before they execute by registering a callback that will get
266266
// called when the command gets executed. This allows GUI or command line
267267
// interfaces to intercept a command and stop it from happening
268+
#ifndef SWIG
268269
bool SetCommandOverrideCallback(const char *command_name,
269270
lldb::CommandOverrideCallback callback,
270271
void *baton);
272+
#endif
271273

272274
/// Return true if the command interpreter is the active IO handler.
273275
///

lldb/test/API/python_api/interpreter/TestCommandOverrideCallback.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)