Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi session debugging #517

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

zobo
Copy link
Contributor

@zobo zobo commented Mar 2, 2021

Current support for multiple sessions is implemented by presenting different Xdebug sessions as DAP threads. The correct way of doing this would be to present each Xdebug session as individual DAP session. The DAP in it self does not support this (microsoft/vscode#116730) however vscode does, by extension code: https://code.visualstudio.com/api/extension-guides/debugger-extension#alternative-approach-to-develop-a-debugger-extension

The implementation I chose starts one DAP session that listens for Xdebug sessions. When Xdebug receives a connection a custom event is sent to extension code, and than in turn spawns a new DAP session. The socket object is stored statically and referenced via uniq id.

This way each Xdebug session has an isolated DAP state.

One DAP session listens for connection and initiates a new DAP session via custom NewDbgpConnectionEvent.
The extension activate/deactivate is created to short-circuit starting on new DAP sessions and forcing them to all be in-process.
@zobo zobo added the feature label Mar 2, 2021
zobo added 3 commits March 7, 2021 21:10
… multi instance, depending on how it is started.

When closing listen socket, do not wait for all clients to close. Some can continue to be connected and live on in different instances of DAP sessions.
Refactor launch closure function into private methods for better reuse.
Handle both launchRequest and attachRequest - but only as connection handover.
@codecov-io
Copy link

codecov-io commented Mar 7, 2021

Codecov Report

Merging #517 (6da5d06) into main (c18654d) will decrease coverage by 1.59%.
The diff coverage is 59.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #517      +/-   ##
==========================================
- Coverage   66.69%   65.09%   -1.60%     
==========================================
  Files           6        7       +1     
  Lines        1075     1126      +51     
  Branches      170      177       +7     
==========================================
+ Hits          717      733      +16     
- Misses        358      393      +35     
Impacted Files Coverage Δ
src/extension.ts 0.00% <0.00%> (ø)
src/phpDebug.ts 65.84% <68.18%> (-1.30%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c18654d...6da5d06. Read the comment docs.

…to send a disconnectRequest this this session and that causes all threads to disconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants