[Lldb-commits] [lldb] Move checking m_dummy_target to after raw-plus-option parsing. (PR #170888)

via lldb-commits lldb-commits at lists.llvm.org
Fri Dec 5 09:23:57 PST 2025


https://github.com/jimingham created https://github.com/llvm/llvm-project/pull/170888

CommandObjectBreakpointAddPattern is a raw command.  I was adjusting the patch for changes to handle the dummy target changes done while the patch was in review, and I copied the lines to the beginning of the DoExecute, but in the case of raw commands, you have to do the option parsing by hand, and this was before the parsing was done so the state wasn't determined yet.

>From 2640edc8d4965f85b80aee64a55e180e41378655 Mon Sep 17 00:00:00 2001
From: Jim Ingham <jingham at apple.com>
Date: Fri, 5 Dec 2025 09:18:41 -0800
Subject: [PATCH] Move checking m_dummy_target to after raw-plus-option
 parsing.

CommandObjectBreakpointAddPattern is a raw command.  I was adjusting
the patch for changes to handle the dummy target changes done while
the patch was in review, and I copied the lines to the beginning of
the DoExecute, but in the case of raw commands, you have to do the
option parsing by hand, and this was before the parsing was done
so the state wasn't determined yet.
---
 lldb/source/Commands/CommandObjectBreakpoint.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index c06b3ee028b69..8e163fbfb8942 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -1255,8 +1255,6 @@ class CommandObjectBreakpointAddPattern : public CommandObjectRaw {
                  CommandReturnObject &result) override {
     const bool internal = false;
     ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
-    Target &target =
-        m_dummy_options.m_use_dummy ? GetDummyTarget() : GetTarget();
     m_all_options.NotifyOptionParsingStarting(&exe_ctx);
 
     if (command.empty()) {
@@ -1279,6 +1277,9 @@ class CommandObjectBreakpointAddPattern : public CommandObjectRaw {
     }
     printf("Pattern: '%s'\n", pattern.str().c_str());
 
+    Target &target =
+        m_dummy_options.m_use_dummy ? GetDummyTarget() : GetTarget();
+
     BreakpointSP bp_sp;
     const size_t num_files = m_options.m_files.GetSize();
 



More information about the lldb-commits mailing list