Add a new SBDebugger::SetDestroyCallback() API

Adding a new SBDebugger::SetDestroyCallback() API.
This API can be used by any client to query for statistics/metrics before
exiting debug sessions.

Differential Revision: https://reviews.llvm.org/D143520
This commit is contained in:
Jeffrey Tan
2023-02-03 17:09:09 -08:00
parent 6e2ade23c7
commit b461398f1c
9 changed files with 96 additions and 1 deletions

View File

@@ -1062,4 +1062,16 @@ static void LLDBSwigPythonCallPythonLogOutputCallback(const char *str,
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
// For DebuggerTerminateCallback functions
static void LLDBSwigPythonCallPythonSBDebuggerTerminateCallback(lldb::user_id_t debugger_id,
void *baton) {
if (baton != Py_None) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyObject *result = PyObject_CallFunction(
reinterpret_cast<PyObject *>(baton), const_cast<char *>("l"), debugger_id);
Py_XDECREF(result);
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
%}