[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:39 PDT 2024


================
@@ -1827,6 +1838,15 @@ class CommandObjectScriptingObjectParsed : public CommandObjectParsed {
 
   ScriptedCommandSynchronicity GetSynchronicity() { return m_synchro; }
 
+  std::optional<std::string> GetRepeatCommand(Args &args,
+                                              uint32_t index) override {
+    ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter();
+    if (!scripter)
+      return std::nullopt;
+
+    return scripter->GetRepeatCommandForScriptedCommand(m_cmd_obj_sp, args);
+  }
+
----------------
medismailben wrote:

nit: This looks pretty much the same as the one in `CommandObjectScriptingObjectRaw`. I understand that these have different base classes but I guess we could use multiple inheritance (in a follow-up) to refactor the 2 classes and reduce code duplication.

https://github.com/llvm/llvm-project/pull/94823


More information about the lldb-commits mailing list