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

Unclear meaning of "debug session" #386

Open
mickaelistria opened this issue Apr 14, 2023 · 4 comments
Open

Unclear meaning of "debug session" #386

mickaelistria opened this issue Apr 14, 2023 · 4 comments

Comments

@mickaelistria
Copy link

I'm trying to implement support for startDebugging in Eclipse LSP4E, using the dapDebugServer.js build by vscode-js-debug.
But after many attempts, I didn't yet manage to figure out from the spec and the code what should be done to properly handle the startDebugging request.
The specification mentions "debug session", but what is a "debug session" exactly? Particularly, how do I start a new "debug session"? Should I send initialized again, or send only launch; should I reuse the same connection or spawn a new debug adapter...? It would be great if the spec could clarify when does a new debug session start, and how to start one as a reaction of startDebugging.

@puremourning
Copy link
Contributor

puremourning commented Apr 14, 2023

But after many attempts, I didn't yet manage to figure out from the spec and the code what should be done to properly handle the startDebugging request.

You're not the only one.

Particularly, how do I start a new "debug session"? Should I send initialized again, or send only launch; should I reuse the same connection or spawn a new debug adapter...?

You just have to go to each and every server vendor and ask their interpretation, which differs depending on their particular interpretation.

  • vscode-js-debug: you should connect to the same socked, and initialise as normal. You should not start a new instance of adapter (though, the authors agree you could based on the spec)
  • debugpy: you must dive into the opaque data and implement a vscode-specific bit of logic. You must not start a new debug adapter instance, like the spec says you should, you must always connect to the host/port via TCP that you pulled out of the opaque data in a completely server-specific way.

There may be others, I've not seen them.

So, in short, while I think the spec is actually very clear about what clients must do, the implementations don't actually implement that, despite the long and tedious discussion that we all had about this on the original proposal.

@puremourning
Copy link
Contributor

puremourning commented Apr 14, 2023

Should I send initialized again, or send only launch

this is easy to answer. You should perform the full sequence as if a completely independent debug adapter, i.e. you should send initilialze,get response, sent launch (or attach depending on the startDebugging request), and the usual breakpoints, initializationDone, etc. dance.

So each "session" is completely independent.

@mickaelistria
Copy link
Author

this is easy to answer. You should perform the full sequence as if a completely independent debug adapter

OK thanks. It was my first interpretation from the spec; so it looks like the spec is clear enough on what to send; what is less clear is where or how to send it; and it looks like this remain adapter-specific.
The issue you link are closed. Would it make sense to open a new one to make the spec clearer on how both server and clients should handle multi-sessions instead and fill the gap so there is no more room for interpretation?

@puremourning
Copy link
Contributor

I agree that further clarification is required in the spec, as the only 2 implementations I've seen so far don't seem to agree on its interpretation, and at least 3 independent client authors (including you and me) struggled to get them working.

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

No branches or pull requests

2 participants