================
@@ -3584,6 +3584,221 @@ class CommandObjectBreakpointWrite : public 
CommandObjectParsed {
   CommandOptions m_options;
 };
 
+#pragma mark override add
+#define LLDB_OPTIONS_breakpoint_override_add
+#include "CommandOptions.inc"
+
+class CommandObjectBreakpointOverrideAdd : public CommandObjectParsed {
+public:
+  CommandObjectBreakpointOverrideAdd(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "breakpoint override add",
+                            "Add a scripted breakpoint override resolver.",
+                            nullptr),
+        m_python_class_options("breakpoint override resolver", true, 'P') {
+    // We're picking up all the normal options, commands and disable.
+    m_all_options.Append(&m_python_class_options,
+                         LLDB_OPT_SET_1 | LLDB_OPT_SET_2, LLDB_OPT_SET_1);
+    m_all_options.Append(&m_dummy_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+    m_all_options.Append(&m_options, llvm::ArrayRef<llvm::StringRef>());
+    m_all_options.Finalize();
+  }
+
+  ~CommandObjectBreakpointOverrideAdd() override = default;
+
+  class CommandOptions : public OptionGroup {
+  public:
+    CommandOptions() = default;
+
+    ~CommandOptions() override = default;
+
+    Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
+                          ExecutionContext *execution_context) override {
+      Status error;
+      const int short_option = GetDefinitions()[option_idx].short_option;
+
+      switch (short_option) {
+      case 'd':
+        m_description.assign(std::string(option_arg));
+        break;
+      default:
+        llvm_unreachable("Unimplemented option");
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_description.clear();
+    }
+
+    llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+      return llvm::ArrayRef(g_breakpoint_override_add_options);
+    }
+
+    // Instance variables to hold the values for command options.
+
+    std::string m_description;
+  };
+  Options *GetOptions() override { return &m_all_options; }
+
+protected:
+  void DoExecute(Args &command, CommandReturnObject &result) override {
+    Target &target =
+        m_dummy_options.m_use_dummy ? GetDummyTarget() : GetTarget();
+    uint64_t id = target.AddBreakpointResolverOverride(
+        m_python_class_options.GetName(),
+        m_python_class_options.GetStructuredData(), m_options.m_description);
+    result.AppendMessageWithFormatv("{0}", id);
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+  }
+
+private:
+  BreakpointDummyOptionGroup m_dummy_options;
+  OptionGroupPythonClassWithDict m_python_class_options;
+  CommandOptions m_options;
+  OptionGroupOptions m_all_options;
+};
+
+class CommandObjectBreakpointOverrideDelete : public CommandObjectParsed {
+public:
+  CommandObjectBreakpointOverrideDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "breakpoint override delete",
+                            "Add a scripted breakpoint override resolver.",
----------------
JDevlieghere wrote:

```suggestion
                            "Delete a scripted breakpoint override resolver.",
```

https://github.com/llvm/llvm-project/pull/195392
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to