[Lldb-commits] [lldb] Add a `breakpoint add` command to fix the option-madness that is `breakpoint set` (PR #156067)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 7 12:02:19 PST 2025


================
@@ -200,41 +200,1341 @@ class lldb_private::BreakpointOptionGroup : public OptionGroup {
   BreakpointOptions m_bp_opts;
 };
 
+// This is the Breakpoint Names option group - used to add Names to breakpoints
+// while making them.  Not to be confused with the "Breakpoint Name" option
+// group which is the common options of various "breakpoint name" commands.
+#define LLDB_OPTIONS_breakpoint_names
+#include "CommandOptions.inc"
+
+class BreakpointNamesOptionGroup : public OptionGroup {
+public:
+  BreakpointNamesOptionGroup() = default;
+
+  ~BreakpointNamesOptionGroup() override = default;
+
+  llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
+    return g_breakpoint_names_options;
+  }
+
+  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
+                        ExecutionContext *execution_context) override {
+    Status error;
+    const int short_option = GetDefinitions()[option_idx].short_option;
+    const char *long_option = GetDefinitions()[option_idx].long_option;
+
+    switch (short_option) {
+    case 'N':
+      if (BreakpointID::StringIsBreakpointName(option_value, error))
+        m_breakpoint_names.push_back(std::string(option_value));
+      else
+        error = Status::FromError(
+            CreateOptionParsingError(option_value, short_option, long_option,
+                                     "Invalid breakpoint name"));
----------------
JDevlieghere wrote:

```suggestion
                                     "invalid breakpoint name"));
```

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


More information about the lldb-commits mailing list