Skip to content

Unclear meaning of "debug session" #386

Open

Description

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.

Activity

  1. puremourning commented on Apr 14, 2023

    @puremourning
    Contributor

    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.

  2. puremourning commented on Apr 14, 2023

    @puremourning
    Contributor

    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.

  3. mickaelistria commented on Apr 14, 2023

    @mickaelistria
    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?

  4. puremourning commented on Apr 14, 2023

    @puremourning
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions