[Lldb-commits] [lldb] [lldb-dap] End the session before sending the disconnect response (PR #227106)

Yao Qi via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 29 04:49:11 PDT 2026


================
@@ -465,6 +472,24 @@ struct DAP final : public DAPTransport::MessageHandler {
   void TransportHandler();
   void TerminateLoop(bool failed = false);
 
+  /// What `Loop()` does with the queued messages. It only moves forward.
+  enum class QueueState {
+    Running,
+    /// The client closed the connection, or the transport failed.
+    InputClosed,
+    /// `Disconnect()` ended the session and we killed or detached the debuggee.
+    Disconnected,
+  };
+
+  /// Moves the queue to `state` on update the state if it is lesser than the
+  /// current state. Used in `Loop()` and requires `m_queue_mutex`.
+  void SetQueueState(QueueState state);
----------------
qiyao wrote:

`SetQueueState`'s doc comment is inverted, it says "if lesser" but the code does the opposite.
```
void DAP::SetQueueState(QueueState state) {
  if (state > m_queue_state)
    m_queue_state = state;
  m_queue_cv.notify_all();
}
```

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


More information about the lldb-commits mailing list