[Lldb-commits] [lldb] Revert "[lldb-dap] Use SetTarget for launch and attach commands (#200133)" (PR #201796)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 5 02:26:06 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/201796

This reverts commit 09f30ef6105e3f9695ad876fcb5add2e7917712b.

**TESTING THAT IT FIXES CI TESTS**

>From 2b107472ad4682296e06796bb071a4ce1d1d8e07 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Fri, 5 Jun 2026 10:25:06 +0100
Subject: [PATCH] Revert "[lldb-dap] Use SetTarget for launch and attach
 commands (#200133)"

This reverts commit 09f30ef6105e3f9695ad876fcb5add2e7917712b.
---
 .../lldb-dap/attach-commands/TestDAP_attachCommands.py   | 4 ----
 .../launch/TestDAP_launch_extra_launch_commands.py       | 9 +--------
 lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp     | 2 +-
 lldb/tools/lldb-dap/Handler/RequestHandler.cpp           | 2 +-
 4 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py b/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
index f24a32edbaa7b..056e213a6fc81 100644
--- a/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
+++ b/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
@@ -77,10 +77,6 @@ def test_commands(self):
         output = self.collect_console(pattern=stopCommands[-1])
         self.verify_commands("stopCommands", output, stopCommands)
 
-        # Check that we got module events from target
-        modules = self.dap_server.wait_for_module_events()
-        self.assertGreater(len(modules), 0)
-
         # Continue after launch and hit the "pause()" call and stop the target.
         # Get output from the console. This should contain both the
         # "stopCommands" that were run after we stop.
diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_extra_launch_commands.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_extra_launch_commands.py
index ad48af6364aba..46a1b0a6165c9 100644
--- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_extra_launch_commands.py
+++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_extra_launch_commands.py
@@ -57,15 +57,8 @@ def test(self):
         # After execution, program should launch
         self.verify_commands("launchCommands", output, launchCommands)
         self.verify_commands("postRunCommands", output, postRunCommands)
-
-        # Finish configuration and continue target
-        self.verify_configuration_done()
-
-        # Check that we got module events from target
-        modules = self.dap_server.wait_for_module_events()
-        self.assertGreater(len(modules), 0)
-
         # Verify the "stopCommands" here
+        self.continue_to_next_stop()
         output = self.get_console()
         self.verify_commands("stopCommands", output, stopCommands)
 
diff --git a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
index c4cfbcbd3d73c..03b26f63292f3 100644
--- a/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/AttachRequestHandler.cpp
@@ -103,7 +103,7 @@ Error AttachRequestHandler::Run(const AttachRequestArguments &args) const {
       if (llvm::Error err = dap.RunAttachCommands(args.attachCommands))
         return err;
 
-      dap.SetTarget(dap.debugger.GetSelectedTarget());
+      dap.target = dap.debugger.GetSelectedTarget();
 
       // Validate the attachCommand results.
       if (!dap.target.GetProcess().IsValid())
diff --git a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index f375a409d251a..e44e09e4741e4 100644
--- a/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
@@ -261,7 +261,7 @@ llvm::Error BaseRequestHandler::LaunchProcess(
 
       // The custom commands might have created a new target so we should use
       // the selected target after these commands are run.
-      dap.SetTarget(dap.debugger.GetSelectedTarget());
+      dap.target = dap.debugger.GetSelectedTarget();
     }
   }
 



More information about the lldb-commits mailing list