Skip to content

Conversation

@qxy11
Copy link
Contributor

@qxy11 qxy11 commented Nov 26, 2025

Summary

This is a forward fix for test errors from #163653.

The PR moved debugger initialization outside of InitializeRequestHandler, and into Launch/AttachRequestHandlers to support DAP sessions sharing debugger instances for dynamically created targets. However, DExTer's DAP class seemed to set breakpoints before the debugger was initialized, which caused the tests to hang waiting for a breakpoint to hit due to none of the breakpoints getting resolved.

Tests

bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/

@qxy11 qxy11 reopened this Nov 27, 2025
@qxy11 qxy11 requested a review from SLTozer November 27, 2025 00:42
Copy link
Contributor

@jeffreytan81 jeffreytan81 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Accept to unblock buildbots.

@qxy11 qxy11 merged commit fb18f75 into llvm:main Nov 27, 2025
8 of 9 checks passed
GeneraluseAI pushed a commit to GeneraluseAI/llvm-project that referenced this pull request Nov 27, 2025
…lvm#169744)

# Summary
This is a forward fix for test errors from
llvm#163653.

The PR moved debugger initialization outside of
InitializeRequestHandler, and into Launch/AttachRequestHandlers to
support DAP sessions sharing debugger instances for dynamically created
targets. However, DExTer's DAP class seemed to set breakpoints before
the debugger was initialized, which caused the tests to hang waiting for
a breakpoint to hit due to none of the breakpoints getting resolved.

# Tests
```
bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/
```
@SLTozer
Copy link
Contributor

SLTozer commented Dec 2, 2025

For some post-commit review (sorry for getting to this late!) - the sequencing here doesn't look correct according to the DAP specification. According to the specification, the launch request should only be responded to by the adapter after the configurationDone request has been responded to. There isn't an exact linear order given to the setup steps, but the explicitly given orderings are:

  • All configuration requests (breakpoints and configurationDone) from the client must only be sent after the initialized event has been received.
  • The launch request must only be sent after the initialize response has been received.
  • The launch response must only be sent (and the debug session started) after the configurationDone response has been sent.

Dexter does not honor the first rule - there was/is no explicit wait for the initialized event before flushing breakpoints - but the practical reason for this is that LLDB doesn't send the initialized event until after the launch response, meaning that that rule has to be ignored. Now however, Dexter is expecting the launch response before sending any configuration requests, which is also incompatible with the spec as written, which causes issues when interfacing with other DAP implementations.

Is it possible to implement the feature added in #163653 while also adhering to the DAP specification? As far as I can tell, the only necessary difference in terms of event sequencing would be to defer the response to the launch request until after the configurationDone response has been sent, or to accept configuration commands before sending the launch response, so that Dexter can still send requests in the order launch->breakpoints->configurationDone without conflicting with the debugger.

augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
…lvm#169744)

# Summary
This is a forward fix for test errors from
llvm#163653.

The PR moved debugger initialization outside of
InitializeRequestHandler, and into Launch/AttachRequestHandlers to
support DAP sessions sharing debugger instances for dynamically created
targets. However, DExTer's DAP class seemed to set breakpoints before
the debugger was initialized, which caused the tests to hang waiting for
a breakpoint to hit due to none of the breakpoints getting resolved.

# Tests
```
bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/
```
SLTozer added a commit to SLTozer/llvm-project that referenced this pull request Dec 3, 2025
Following PR llvm#169744 the DAP launch sequencing of Dexter was changed to
complete a launch request/response before performing configuration steps.
This matches LLDB's current behaviour, but is not compatible with the DAP
specification and causes issues interfacing with other debuggers.

This patch tries to bridge the gap by using a sequencing that is mostly
DAP-compliant while still interfacing correctly with lldb-dap: we send a
launch request first, then perform all configuration steps and sending
configurationDone, and then awaiting the launch response. For lldb-dap,
we do not wait for the launch response and may send configuration requests
before it is received, but lldb-dap appears to handle this without issue.
For other debug adapters, the launch request will be ignored until the
configurationDone request is received and responded to, at which point
the launch request will be acted upon and responded to.

As an additional note, the initialized event should be sent after the
initialize response and before the launch request according to the spec,
but as LLDB currently sends it after the launch response Dexter has
avoided checking for it. Since the initialized event is now being sent
after the launch response by LLDB, we can start checking for it earlier in
the sequence as well (though technically the client should receive the
initialized event before it sends the launch request).
kcloudy0717 pushed a commit to kcloudy0717/llvm-project that referenced this pull request Dec 4, 2025
…lvm#169744)

# Summary
This is a forward fix for test errors from
llvm#163653.

The PR moved debugger initialization outside of
InitializeRequestHandler, and into Launch/AttachRequestHandlers to
support DAP sessions sharing debugger instances for dynamically created
targets. However, DExTer's DAP class seemed to set breakpoints before
the debugger was initialized, which caused the tests to hang waiting for
a breakpoint to hit due to none of the breakpoints getting resolved.

# Tests
```
bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/
```
SLTozer added a commit that referenced this pull request Dec 9, 2025
)

Following PR #169744 the DAP launch sequencing of Dexter was changed to
complete a launch request/response before performing configuration
steps. This matches LLDB's current behaviour, but is not compatible with
the DAP specification and causes issues interfacing with other
debuggers.

This patch tries to bridge the gap by using a sequencing that is mostly
DAP-compliant while still interfacing correctly with lldb-dap: we send a
launch request first, then perform all configuration steps and send
configurationDone, and then await the launch response. For lldb-dap, we
do not wait for the launch response and may send configuration requests
before it is received, but lldb-dap appears to handle this without
issue. For other debug adapters, the launch request will be ignored
until the configurationDone request is received and responded to, at
which point the launch request will be acted upon and responded to.

As an additional note, the initialized event should be sent after the
initialize response and before the launch request according to the spec,
but as LLDB currently sends it after the launch response Dexter has
avoided checking for it. Since the initialized event is now being sent
after the launch response by LLDB, we can start checking for it earlier
in the sequence as well (though technically the client should receive
the initialized event before it sends the launch request).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants