Skip to content

Commit 414f399

Browse files
authored
Merge pull request #9955 from swiftlang/cherrypick-stable/20240723-74690327c8fb-c1e9b908d9c2-26c2da5a1225-dbabad0fc04e-6deee0d5b36c-906eeeda833b-97f6e533865c-53d6e59b5946
[lldb] Support CommandInterpreter print callbacks
2 parents d864437 + ca456bf commit 414f399

27 files changed

+538
-141
lines changed

lldb/bindings/python/python-swigsafecast.swig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBValue> value_sb)
99
return ToSWIGHelper(value_sb.release(), SWIGTYPE_p_lldb__SBValue);
1010
}
1111

12+
PythonObject SWIGBridge::ToSWIGWrapper(std::unique_ptr<lldb::SBCommandReturnObject> result_up) {
13+
return ToSWIGHelper(result_up.release(), SWIGTYPE_p_lldb__SBCommandReturnObject);
14+
}
15+
1216
PythonObject SWIGBridge::ToSWIGWrapper(lldb::ValueObjectSP value_sp) {
1317
return ToSWIGWrapper(std::unique_ptr<lldb::SBValue>(new lldb::SBValue(value_sp)));
1418
}

lldb/bindings/python/python-typemaps.swig

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,25 @@ template <> bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
476476
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject *>($input));
477477
}
478478

479+
// For lldb::SBCommandPrintCallback
480+
%typemap(in) (lldb::SBCommandPrintCallback callback, void *baton) {
481+
if (!($input == Py_None ||
482+
PyCallable_Check(reinterpret_cast<PyObject *>($input)))) {
483+
PyErr_SetString(PyExc_TypeError, "Need a callable object or None!");
484+
SWIG_fail;
485+
}
486+
487+
// Don't lose the callback reference.
488+
Py_INCREF($input);
489+
$1 = LLDBSwigPythonCallPythonCommandPrintCallback;
490+
$2 = $input;
491+
}
492+
493+
%typemap(typecheck) (lldb::SBCommandPrintCallback callback, void *baton) {
494+
$1 = $input == Py_None;
495+
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject *>($input));
496+
}
497+
479498
%typemap(in) (lldb::CommandOverrideCallback callback, void *baton) {
480499
if (!($input == Py_None ||
481500
PyCallable_Check(reinterpret_cast<PyObject *>($input)))) {

lldb/bindings/python/python-wrapper.swig

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject(
765765
auto pfunc = self.ResolveName<PythonCallable>("__call__");
766766

767767
if (!pfunc.IsAllocated()) {
768-
cmd_retobj.AppendError("Could not find '__call__' method in implementation class");
768+
cmd_retobj.AppendError("Could not find '__call__' method in implementation class");
769769
return false;
770770
}
771771

@@ -1024,6 +1024,26 @@ static void LLDBSwigPythonCallPythonLogOutputCallback(const char *str,
10241024
}
10251025
}
10261026

1027+
// For CommandPrintCallback functions
1028+
static CommandReturnObjectCallbackResult LLDBSwigPythonCallPythonCommandPrintCallback(SBCommandReturnObject& result, void *callback_baton) {
1029+
SWIG_Python_Thread_Block swig_thread_block;
1030+
1031+
PyErr_Cleaner py_err_cleaner(true);
1032+
1033+
PythonObject result_arg = SWIGBridge::ToSWIGWrapper(
1034+
std::make_unique<SBCommandReturnObject>(result));
1035+
PythonCallable callable =
1036+
Retain<PythonCallable>(reinterpret_cast<PyObject *>(callback_baton));
1037+
1038+
if (!callable.IsValid())
1039+
return eCommandReturnObjectPrintCallbackSkipped;
1040+
1041+
PythonObject callback_result = callable(result_arg);
1042+
1043+
long long ret_val = unwrapOrSetPythonException(As<long long>(callback_result));
1044+
return (CommandReturnObjectCallbackResult)ret_val;
1045+
}
1046+
10271047
// For DebuggerTerminateCallback functions
10281048
static void LLDBSwigPythonCallPythonSBDebuggerTerminateCallback(lldb::user_id_t debugger_id,
10291049
void *baton) {

lldb/bindings/python/static-binding/LLDBWrapPython.cpp

Lines changed: 150 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5652,7 +5652,7 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject(
56525652
auto pfunc = self.ResolveName<PythonCallable>("__call__");
56535653

56545654
if (!pfunc.IsAllocated()) {
5655-
cmd_retobj.AppendError("Could not find '__call__' method in implementation class");
5655+
cmd_retobj.AppendError("Could not find '__call__' method in implementation class");
56565656
return false;
56575657
}
56585658

@@ -5911,6 +5911,26 @@ static void LLDBSwigPythonCallPythonLogOutputCallback(const char *str,
59115911
}
59125912
}
59135913

5914+
// For CommandPrintCallback functions
5915+
static CommandReturnObjectCallbackResult LLDBSwigPythonCallPythonCommandPrintCallback(SBCommandReturnObject& result, void *callback_baton) {
5916+
SWIG_Python_Thread_Block swig_thread_block;
5917+
5918+
PyErr_Cleaner py_err_cleaner(true);
5919+
5920+
PythonObject result_arg = SWIGBridge::ToSWIGWrapper(
5921+
std::make_unique<SBCommandReturnObject>(result));
5922+
PythonCallable callable =
5923+
Retain<PythonCallable>(reinterpret_cast<PyObject *>(callback_baton));
5924+
5925+
if (!callable.IsValid())
5926+
return eCommandReturnObjectPrintCallbackSkipped;
5927+
5928+
PythonObject callback_result = callable(result_arg);
5929+
5930+
long long ret_val = unwrapOrSetPythonException(As<long long>(callback_result));
5931+
return (CommandReturnObjectCallbackResult)ret_val;
5932+
}
5933+
59145934
// For DebuggerTerminateCallback functions
59155935
static void LLDBSwigPythonCallPythonSBDebuggerTerminateCallback(lldb::user_id_t debugger_id,
59165936
void *baton) {
@@ -17699,6 +17719,46 @@ SWIGINTERN PyObject *_wrap_SBCommandInterpreter_GetTranscript(PyObject *self, Py
1769917719
}
1770017720

1770117721

17722+
SWIGINTERN PyObject *_wrap_SBCommandInterpreter_SetPrintCallback(PyObject *self, PyObject *args) {
17723+
PyObject *resultobj = 0;
17724+
lldb::SBCommandInterpreter *arg1 = (lldb::SBCommandInterpreter *) 0 ;
17725+
lldb::SBCommandPrintCallback arg2 = (lldb::SBCommandPrintCallback) 0 ;
17726+
void *arg3 = (void *) 0 ;
17727+
void *argp1 = 0 ;
17728+
int res1 = 0 ;
17729+
PyObject *swig_obj[2] ;
17730+
17731+
(void)self;
17732+
if (!SWIG_Python_UnpackTuple(args, "SBCommandInterpreter_SetPrintCallback", 2, 2, swig_obj)) SWIG_fail;
17733+
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBCommandInterpreter, 0 | 0 );
17734+
if (!SWIG_IsOK(res1)) {
17735+
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBCommandInterpreter_SetPrintCallback" "', argument " "1"" of type '" "lldb::SBCommandInterpreter *""'");
17736+
}
17737+
arg1 = reinterpret_cast< lldb::SBCommandInterpreter * >(argp1);
17738+
{
17739+
if (!(swig_obj[1] == Py_None ||
17740+
PyCallable_Check(reinterpret_cast<PyObject *>(swig_obj[1])))) {
17741+
PyErr_SetString(PyExc_TypeError, "Need a callable object or None!");
17742+
SWIG_fail;
17743+
}
17744+
17745+
// Don't lose the callback reference.
17746+
Py_INCREF(swig_obj[1]);
17747+
arg2 = LLDBSwigPythonCallPythonCommandPrintCallback;
17748+
arg3 = swig_obj[1];
17749+
}
17750+
{
17751+
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
17752+
(arg1)->SetPrintCallback(arg2,arg3);
17753+
SWIG_PYTHON_THREAD_END_ALLOW;
17754+
}
17755+
resultobj = SWIG_Py_Void();
17756+
return resultobj;
17757+
fail:
17758+
return NULL;
17759+
}
17760+
17761+
1770217762
SWIGINTERN PyObject *SBCommandInterpreter_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
1770317763
PyObject *obj = NULL;
1770417764
if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
@@ -18665,6 +18725,34 @@ SWIGINTERN PyObject *_wrap_SBCommandReturnObject_IsValid(PyObject *self, PyObjec
1866518725
}
1866618726

1866718727

18728+
SWIGINTERN PyObject *_wrap_SBCommandReturnObject_GetCommand(PyObject *self, PyObject *args) {
18729+
PyObject *resultobj = 0;
18730+
lldb::SBCommandReturnObject *arg1 = (lldb::SBCommandReturnObject *) 0 ;
18731+
void *argp1 = 0 ;
18732+
int res1 = 0 ;
18733+
PyObject *swig_obj[1] ;
18734+
char *result = 0 ;
18735+
18736+
(void)self;
18737+
if (!args) SWIG_fail;
18738+
swig_obj[0] = args;
18739+
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBCommandReturnObject, 0 | 0 );
18740+
if (!SWIG_IsOK(res1)) {
18741+
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBCommandReturnObject_GetCommand" "', argument " "1"" of type '" "lldb::SBCommandReturnObject *""'");
18742+
}
18743+
arg1 = reinterpret_cast< lldb::SBCommandReturnObject * >(argp1);
18744+
{
18745+
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
18746+
result = (char *)(arg1)->GetCommand();
18747+
SWIG_PYTHON_THREAD_END_ALLOW;
18748+
}
18749+
resultobj = SWIG_FromCharPtr((const char *)result);
18750+
return resultobj;
18751+
fail:
18752+
return NULL;
18753+
}
18754+
18755+
1866818756
SWIGINTERN PyObject *_wrap_SBCommandReturnObject_GetOutput__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
1866918757
PyObject *resultobj = 0;
1867018758
lldb::SBCommandReturnObject *arg1 = (lldb::SBCommandReturnObject *) 0 ;
@@ -29195,6 +29283,33 @@ SWIGINTERN PyObject *_wrap_SBDebugger_GetSyntheticForType(PyObject *self, PyObje
2919529283
}
2919629284

2919729285

29286+
SWIGINTERN PyObject *_wrap_SBDebugger_ResetStatistics(PyObject *self, PyObject *args) {
29287+
PyObject *resultobj = 0;
29288+
lldb::SBDebugger *arg1 = (lldb::SBDebugger *) 0 ;
29289+
void *argp1 = 0 ;
29290+
int res1 = 0 ;
29291+
PyObject *swig_obj[1] ;
29292+
29293+
(void)self;
29294+
if (!args) SWIG_fail;
29295+
swig_obj[0] = args;
29296+
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBDebugger, 0 | 0 );
29297+
if (!SWIG_IsOK(res1)) {
29298+
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBDebugger_ResetStatistics" "', argument " "1"" of type '" "lldb::SBDebugger *""'");
29299+
}
29300+
arg1 = reinterpret_cast< lldb::SBDebugger * >(argp1);
29301+
{
29302+
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
29303+
(arg1)->ResetStatistics();
29304+
SWIG_PYTHON_THREAD_END_ALLOW;
29305+
}
29306+
resultobj = SWIG_Py_Void();
29307+
return resultobj;
29308+
fail:
29309+
return NULL;
29310+
}
29311+
29312+
2919829313
SWIGINTERN PyObject *_wrap_SBDebugger_RunCommandInterpreter(PyObject *self, PyObject *args) {
2919929314
PyObject *resultobj = 0;
2920029315
lldb::SBDebugger *arg1 = (lldb::SBDebugger *) 0 ;
@@ -65557,6 +65672,33 @@ SWIGINTERN PyObject *_wrap_SBTarget_GetStatistics(PyObject *self, PyObject *args
6555765672
}
6555865673

6555965674

65675+
SWIGINTERN PyObject *_wrap_SBTarget_ResetStatistics(PyObject *self, PyObject *args) {
65676+
PyObject *resultobj = 0;
65677+
lldb::SBTarget *arg1 = (lldb::SBTarget *) 0 ;
65678+
void *argp1 = 0 ;
65679+
int res1 = 0 ;
65680+
PyObject *swig_obj[1] ;
65681+
65682+
(void)self;
65683+
if (!args) SWIG_fail;
65684+
swig_obj[0] = args;
65685+
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_lldb__SBTarget, 0 | 0 );
65686+
if (!SWIG_IsOK(res1)) {
65687+
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SBTarget_ResetStatistics" "', argument " "1"" of type '" "lldb::SBTarget *""'");
65688+
}
65689+
arg1 = reinterpret_cast< lldb::SBTarget * >(argp1);
65690+
{
65691+
SWIG_PYTHON_THREAD_BEGIN_ALLOW;
65692+
(arg1)->ResetStatistics();
65693+
SWIG_PYTHON_THREAD_END_ALLOW;
65694+
}
65695+
resultobj = SWIG_Py_Void();
65696+
return resultobj;
65697+
fail:
65698+
return NULL;
65699+
}
65700+
65701+
6556065702
SWIGINTERN PyObject *_wrap_SBTarget_GetPlatform(PyObject *self, PyObject *args) {
6556165703
PyObject *resultobj = 0;
6556265704
lldb::SBTarget *arg1 = (lldb::SBTarget *) 0 ;
@@ -96323,6 +96465,7 @@ static PyMethodDef SwigMethods[] = {
9632396465
{ "SBCommandInterpreter_ResolveCommand", _wrap_SBCommandInterpreter_ResolveCommand, METH_VARARGS, "SBCommandInterpreter_ResolveCommand(SBCommandInterpreter self, char const * command_line, SBCommandReturnObject result)"},
9632496466
{ "SBCommandInterpreter_GetStatistics", _wrap_SBCommandInterpreter_GetStatistics, METH_O, "SBCommandInterpreter_GetStatistics(SBCommandInterpreter self) -> SBStructuredData"},
9632596467
{ "SBCommandInterpreter_GetTranscript", _wrap_SBCommandInterpreter_GetTranscript, METH_O, "SBCommandInterpreter_GetTranscript(SBCommandInterpreter self) -> SBStructuredData"},
96468+
{ "SBCommandInterpreter_SetPrintCallback", _wrap_SBCommandInterpreter_SetPrintCallback, METH_VARARGS, "SBCommandInterpreter_SetPrintCallback(SBCommandInterpreter self, lldb::SBCommandPrintCallback callback)"},
9632696469
{ "SBCommandInterpreter_swigregister", SBCommandInterpreter_swigregister, METH_O, NULL},
9632796470
{ "SBCommandInterpreter_swiginit", SBCommandInterpreter_swiginit, METH_VARARGS, NULL},
9632896471
{ "new_SBCommandInterpreterRunOptions", _wrap_new_SBCommandInterpreterRunOptions, METH_VARARGS, "\n"
@@ -96361,6 +96504,7 @@ static PyMethodDef SwigMethods[] = {
9636196504
{ "delete_SBCommandReturnObject", _wrap_delete_SBCommandReturnObject, METH_O, "delete_SBCommandReturnObject(SBCommandReturnObject self)"},
9636296505
{ "SBCommandReturnObject___nonzero__", _wrap_SBCommandReturnObject___nonzero__, METH_O, "SBCommandReturnObject___nonzero__(SBCommandReturnObject self) -> bool"},
9636396506
{ "SBCommandReturnObject_IsValid", _wrap_SBCommandReturnObject_IsValid, METH_O, "SBCommandReturnObject_IsValid(SBCommandReturnObject self) -> bool"},
96507+
{ "SBCommandReturnObject_GetCommand", _wrap_SBCommandReturnObject_GetCommand, METH_O, "SBCommandReturnObject_GetCommand(SBCommandReturnObject self) -> char const *"},
9636496508
{ "SBCommandReturnObject_GetErrorData", _wrap_SBCommandReturnObject_GetErrorData, METH_O, "SBCommandReturnObject_GetErrorData(SBCommandReturnObject self) -> SBStructuredData"},
9636596509
{ "SBCommandReturnObject_PutOutput", _wrap_SBCommandReturnObject_PutOutput, METH_VARARGS, "\n"
9636696510
"SBCommandReturnObject_PutOutput(SBCommandReturnObject self, SBFile file) -> size_t\n"
@@ -96712,6 +96856,7 @@ static PyMethodDef SwigMethods[] = {
9671296856
{ "SBDebugger_GetSummaryForType", _wrap_SBDebugger_GetSummaryForType, METH_VARARGS, "SBDebugger_GetSummaryForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeSummary"},
9671396857
{ "SBDebugger_GetFilterForType", _wrap_SBDebugger_GetFilterForType, METH_VARARGS, "SBDebugger_GetFilterForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeFilter"},
9671496858
{ "SBDebugger_GetSyntheticForType", _wrap_SBDebugger_GetSyntheticForType, METH_VARARGS, "SBDebugger_GetSyntheticForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeSynthetic"},
96859+
{ "SBDebugger_ResetStatistics", _wrap_SBDebugger_ResetStatistics, METH_O, "SBDebugger_ResetStatistics(SBDebugger self)"},
9671596860
{ "SBDebugger_RunCommandInterpreter", _wrap_SBDebugger_RunCommandInterpreter, METH_VARARGS, "\n"
9671696861
"SBDebugger_RunCommandInterpreter(SBDebugger self, bool auto_handle_events, bool spawn_thread, SBCommandInterpreterRunOptions options, int & num_errors, bool & quit_requested, bool & stopped_for_crash)\n"
9671796862
"Launch a command interpreter session. Commands are read from standard input or\n"
@@ -98526,6 +98671,7 @@ static PyMethodDef SwigMethods[] = {
9852698671
"SBTarget_GetStatistics(SBTarget self) -> SBStructuredData\n"
9852798672
"SBTarget_GetStatistics(SBTarget self, SBStatisticsOptions options) -> SBStructuredData\n"
9852898673
""},
98674+
{ "SBTarget_ResetStatistics", _wrap_SBTarget_ResetStatistics, METH_O, "SBTarget_ResetStatistics(SBTarget self)"},
9852998675
{ "SBTarget_GetPlatform", _wrap_SBTarget_GetPlatform, METH_O, "\n"
9853098676
"SBTarget_GetPlatform(SBTarget self) -> SBPlatform\n"
9853198677
"\n"
@@ -102876,6 +103022,7 @@ SWIG_init(void) {
102876103022
SWIG_Python_SetConstant(d, "eSectionTypeDWARFDebugTuIndex",SWIG_From_int(static_cast< int >(lldb::eSectionTypeDWARFDebugTuIndex)));
102877103023
SWIG_Python_SetConstant(d, "eSectionTypeCTF",SWIG_From_int(static_cast< int >(lldb::eSectionTypeCTF)));
102878103024
SWIG_Python_SetConstant(d, "eSectionTypeLLDBTypeSummaries",SWIG_From_int(static_cast< int >(lldb::eSectionTypeLLDBTypeSummaries)));
103025+
SWIG_Python_SetConstant(d, "eSectionTypeLLDBFormatters",SWIG_From_int(static_cast< int >(lldb::eSectionTypeLLDBFormatters)));
102879103026
SWIG_Python_SetConstant(d, "eSectionTypeSwiftModules",SWIG_From_int(static_cast< int >(lldb::eSectionTypeSwiftModules)));
102880103027
SWIG_Python_SetConstant(d, "eEmulateInstructionOptionNone",SWIG_From_int(static_cast< int >(lldb::eEmulateInstructionOptionNone)));
102881103028
SWIG_Python_SetConstant(d, "eEmulateInstructionOptionAutoAdvancePC",SWIG_From_int(static_cast< int >(lldb::eEmulateInstructionOptionAutoAdvancePC)));
@@ -103180,6 +103327,8 @@ SWIG_init(void) {
103180103327
SWIG_Python_SetConstant(d, "eSeverityError",SWIG_From_int(static_cast< int >(lldb::eSeverityError)));
103181103328
SWIG_Python_SetConstant(d, "eSeverityWarning",SWIG_From_int(static_cast< int >(lldb::eSeverityWarning)));
103182103329
SWIG_Python_SetConstant(d, "eSeverityInfo",SWIG_From_int(static_cast< int >(lldb::eSeverityInfo)));
103330+
SWIG_Python_SetConstant(d, "eCommandReturnObjectPrintCallbackSkipped",SWIG_From_int(static_cast< int >(lldb::eCommandReturnObjectPrintCallbackSkipped)));
103331+
SWIG_Python_SetConstant(d, "eCommandReturnObjectPrintCallbackHandled",SWIG_From_int(static_cast< int >(lldb::eCommandReturnObjectPrintCallbackHandled)));
103183103332
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitThreadShouldExit",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitThreadShouldExit)));
103184103333
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitResetPrompt",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitResetPrompt)));
103185103334
SWIG_Python_SetConstant(d, "SBCommandInterpreter_eBroadcastBitQuitCommandReceived",SWIG_From_int(static_cast< int >(lldb::SBCommandInterpreter::eBroadcastBitQuitCommandReceived)));

lldb/bindings/python/static-binding/lldb.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,8 @@ def lldb_iter(obj, getsize, getelem):
12091209

12101210
eSectionTypeLLDBTypeSummaries = _lldb.eSectionTypeLLDBTypeSummaries
12111211

1212+
eSectionTypeLLDBFormatters = _lldb.eSectionTypeLLDBFormatters
1213+
12121214
eSectionTypeSwiftModules = _lldb.eSectionTypeSwiftModules
12131215

12141216
eEmulateInstructionOptionNone = _lldb.eEmulateInstructionOptionNone
@@ -1817,6 +1819,10 @@ def lldb_iter(obj, getsize, getelem):
18171819

18181820
eSeverityInfo = _lldb.eSeverityInfo
18191821

1822+
eCommandReturnObjectPrintCallbackSkipped = _lldb.eCommandReturnObjectPrintCallbackSkipped
1823+
1824+
eCommandReturnObjectPrintCallbackHandled = _lldb.eCommandReturnObjectPrintCallbackHandled
1825+
18201826
class SBAddress(object):
18211827
r"""
18221828
A section + offset based address class.
@@ -3609,6 +3615,10 @@ def GetTranscript(self):
36093615
r"""GetTranscript(SBCommandInterpreter self) -> SBStructuredData"""
36103616
return _lldb.SBCommandInterpreter_GetTranscript(self)
36113617

3618+
def SetPrintCallback(self, callback):
3619+
r"""SetPrintCallback(SBCommandInterpreter self, lldb::SBCommandPrintCallback callback)"""
3620+
return _lldb.SBCommandInterpreter_SetPrintCallback(self, callback)
3621+
36123622
# Register SBCommandInterpreter in _lldb:
36133623
_lldb.SBCommandInterpreter_swigregister(SBCommandInterpreter)
36143624
class SBCommandInterpreterRunOptions(object):
@@ -3761,6 +3771,10 @@ def IsValid(self):
37613771
r"""IsValid(SBCommandReturnObject self) -> bool"""
37623772
return _lldb.SBCommandReturnObject_IsValid(self)
37633773

3774+
def GetCommand(self):
3775+
r"""GetCommand(SBCommandReturnObject self) -> char const *"""
3776+
return _lldb.SBCommandReturnObject_GetCommand(self)
3777+
37643778
def GetErrorData(self):
37653779
r"""GetErrorData(SBCommandReturnObject self) -> SBStructuredData"""
37663780
return _lldb.SBCommandReturnObject_GetErrorData(self)
@@ -5187,6 +5201,10 @@ def GetSyntheticForType(self, arg2):
51875201
r"""GetSyntheticForType(SBDebugger self, SBTypeNameSpecifier arg2) -> SBTypeSynthetic"""
51885202
return _lldb.SBDebugger_GetSyntheticForType(self, arg2)
51895203

5204+
def ResetStatistics(self):
5205+
r"""ResetStatistics(SBDebugger self)"""
5206+
return _lldb.SBDebugger_ResetStatistics(self)
5207+
51905208
def RunCommandInterpreter(self, auto_handle_events, spawn_thread, options, num_errors, quit_requested, stopped_for_crash):
51915209
r"""
51925210
RunCommandInterpreter(SBDebugger self, bool auto_handle_events, bool spawn_thread, SBCommandInterpreterRunOptions options, int & num_errors, bool & quit_requested, bool & stopped_for_crash)
@@ -11243,6 +11261,10 @@ def GetStatistics(self, *args):
1124311261
"""
1124411262
return _lldb.SBTarget_GetStatistics(self, *args)
1124511263

11264+
def ResetStatistics(self):
11265+
r"""ResetStatistics(SBTarget self)"""
11266+
return _lldb.SBTarget_ResetStatistics(self)
11267+
1124611268
def GetPlatform(self):
1124711269
r"""
1124811270
GetPlatform(SBTarget self) -> SBPlatform

lldb/include/lldb/API/SBCommandInterpreter.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ class SBCommandInterpreter {
247247
lldb::SBStringList &matches,
248248
lldb::SBStringList &descriptions);
249249

250-
/// Returns whether an interrupt flag was raised either by the SBDebugger -
250+
/// Returns whether an interrupt flag was raised either by the SBDebugger -
251251
/// when the function is not running on the RunCommandInterpreter thread, or
252252
/// by SBCommandInterpreter::InterruptCommand if it is. If your code is doing
253-
/// interruptible work, check this API periodically, and interrupt if it
253+
/// interruptible work, check this API periodically, and interrupt if it
254254
/// returns true.
255255
bool WasInterrupted() const;
256-
256+
257257
/// Interrupts the command currently executing in the RunCommandInterpreter
258258
/// thread.
259259
///
@@ -331,6 +331,8 @@ class SBCommandInterpreter {
331331
/// this list. Otherwise this list is empty.
332332
SBStructuredData GetTranscript();
333333

334+
void SetPrintCallback(lldb::SBCommandPrintCallback callback, void *baton);
335+
334336
protected:
335337
friend class lldb_private::CommandPluginInterfaceImplementation;
336338

0 commit comments

Comments
 (0)