[llvm] [Dexter] Adjust launch sequencing to align closer with DAP spec (PR #170523)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 3 15:33:22 PST 2025
================
@@ -763,23 +763,39 @@ def launch(self, cmdline):
launch_request = self._get_launch_params(cmdline)
- # Per DAP protocol, the correct sequence is:
+ # Per DAP protocol, we follow the sequence:
# 1. Send launch request
- # 2. Wait for launch response and "initialized" event
- # 3. Set breakpoints
- # 4. Send configurationDone to start the process
+ # 2. Set breakpoints
+ # 3. Send configurationDone to start the process
+ # 4. Wait for launch and configurationDone responses, and a "process" event, to confirm successful launch
+ # NB: Technically, we should also wait for the "initialized" event before sending the launch request, but in
+ # practice there are DAP implementations that do not send the initialized event until post-launch, and all
+ # adapters seem to accept us not waiting for the initialized event, so ignoring it gives maximum compatibility.
----------------
SLTozer wrote:
You're correct that we don't need to wait for the `initialized` event to send the `launch` request - I'll amend the comment. According to the [DAP specification](https://microsoft.github.io/debug-adapter-protocol/overview) though, the `launch` response should only be sent after the `configurationDone` response, and the `configurationDone` request can only be sent after the `initialized` event has been received.
So while there's no error with a client making requests in the order `initialize`->`launch`->`setBreakpoints`->`configurationDone`, it's _technically_ off-spec for the debug adapter to send the `launch` response before sending the `initialized` event, as when you do so it's impossible to maintain the specified ordering of `intialized` event -> `configurationDone` request/response -> `launch` response; as you've noted though it's perfectly valid for the debug adapter to only send the `initialized` event after the `launch` _request_ is received; the main issue that this patch fixes is that Dexter shouldn't wait for the `launch` response before performing configuration, as that makes it incompatible with other debug adapters whose sequencing follows the DAP spec (by only sending the `launch` response after the `configurationDone` response).
https://github.com/llvm/llvm-project/pull/170523
More information about the llvm-commits
mailing list