[Lldb-commits] [lldb] Add the ability for Script based commands to specify their "repeat command" (PR #94823)
Med Ismail Bennani via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 26 18:14:40 PDT 2024
================
@@ -831,6 +831,29 @@ bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject(
return true;
}
+std::optional<std::string>
+lldb_private::python::SWIGBridge::LLDBSwigPythonGetRepeatCommandForScriptedCommand(PyObject *implementor,
+ std::string &command) {
+ PyErr_Cleaner py_err_cleaner(true);
+
+ PythonObject self(PyRefType::Borrowed, implementor);
+ auto pfunc = self.ResolveName<PythonCallable>("get_repeat_command");
+ // If not implemented, repeat the exact command.
+ if (!pfunc.IsAllocated())
+ return std::nullopt;
+
+ PythonObject result;
+ PythonString command_str(command);
+ result = pfunc(command_str);
----------------
medismailben wrote:
nit:
```suggestion
PythonString command_str(command);
PythonObject result = pfunc(command_str);
```
https://github.com/llvm/llvm-project/pull/94823
More information about the lldb-commits
mailing list