[Lldb-commits] [lldb] [lldb-dap] Change the launch sequence (PR #138219)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Fri May 2 11:39:17 PDT 2025


================
@@ -893,10 +893,23 @@ llvm::Error DAP::Loop() {
             return errWrapper;
           }
 
+          // The launch sequence is special and we need to carefully handle
+          // packets in the right order. The launch and attach requests cannot
+          // be answered until we've gotten the confgigurationDone request. We
+          // can't answer the threads request until we've successfully launched
+          // or attached.
+          bool is_part_of_launch_sequence = false;
+
           if (const protocol::Request *req =
-                  std::get_if<protocol::Request>(&*next);
-              req && req->command == "disconnect") {
-            disconnecting = true;
+                  std::get_if<protocol::Request>(&*next)) {
+            if (req->command == "disconnect")
+              disconnecting = true;
----------------
ashgti wrote:

This will set `disconnecting` to `true` before we've actually responded to the request and this also changed the loop to break as soon as it sees this set to `true` (line 964). If there are multiple queued requests then we'll exit before responding to those requests.

Should we instead wait until the queue is empty instead of `disconnecting` is true on line 964?

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


More information about the lldb-commits mailing list