[Lldb-commits] [lldb] [lldb-dap] Use SetTarget for launch commands (PR #200133)

via lldb-commits lldb-commits at lists.llvm.org
Thu May 28 01:34:06 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Sergei Druzhkov (DrSergei)

<details>
<summary>Changes</summary>

Without this patch event listener registration was skipped, as a result `Modules` view in UI was not displayed in case of launching target via `launchCommands`.

---
Full diff: https://github.com/llvm/llvm-project/pull/200133.diff


2 Files Affected:

- (modified) lldb/test/API/tools/lldb-dap/launch/TestDAP_launch_extra_launch_commands.py (+8-1) 
- (modified) lldb/tools/lldb-dap/Handler/RequestHandler.cpp (+1-1) 


``````````diff
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 46a1b0a6165c9..ad48af6364aba 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,8 +57,15 @@ 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/RequestHandler.cpp b/lldb/tools/lldb-dap/Handler/RequestHandler.cpp
index e44e09e4741e4..f375a409d251a 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.target = dap.debugger.GetSelectedTarget();
+      dap.SetTarget(dap.debugger.GetSelectedTarget());
     }
   }
 

``````````

</details>


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


More information about the lldb-commits mailing list