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

Unable to trigger DisconnectArguments.terminateDebuggee #116081

Closed
zobo opened this issue Feb 8, 2021 · 11 comments
Closed

Unable to trigger DisconnectArguments.terminateDebuggee #116081

zobo opened this issue Feb 8, 2021 · 11 comments
Assignees
Labels
*as-designed Described behavior is as designed debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@zobo
Copy link
Contributor

zobo commented Feb 8, 2021

  • VSCode Version: 1.53.0 (user setup)
  • OS Version: Windows_NT x64 10.0.19041

Hello. I am currently maintaining the xdebug/vscode-php-debug extension and wanted to implement a feature. When the PHP process and the debugger are attached the user should have two options to stop debugging:

  1. terminate the debuggee, so execution stops
  2. disconnect the debugger from the debuggee and execution continues.

There are a couple of interesting options in the debugSession.ts:
supportsTerminateRequest, supportsTerminateThreadsRequest supportTerminateDebuggee.

I was currently concentrating on getting DisconnectArguments.terminateDebuggee of disconnectRequest, but was unable to find a scenario where this argument would be present at all.
I was also unable to find any relevant source reference to it in vscode.

Perhaps it has also to do with the request filed in jaunch.json. Currently we always use launch.

What do I need to do, so that the user will have both options available to them: Detach/Disconnect and Stop/Terminate.

Thank you!

Does this issue occur when all extensions are disabled?: Does not apply

@isidorn isidorn added the debug Debug viewlet, configurations, breakpoints, adapter issues label Feb 8, 2021
@isidorn
Copy link
Contributor

isidorn commented Feb 8, 2021

@weinand assigning first to you, feel free to assign back to me and I can try to answer

@weinand
Copy link
Contributor

weinand commented Feb 8, 2021

Yes, the behavior of DAP's "disconnect" can be controlled by the terminateDebuggee property, but VS Code makes no use of this. VS Code relies on the default behavior of the disconnect request:

  • if a debug configuration uses "request": "launch", then the debug adapter is expected to launch the debuggee and consequently it is responsible for terminating it in the implementation of the disconnect request.
  • if a debug configuration uses "request": "attach", then the debug adapter only "attaches" to an already running debuggee. In this case disconnect only needs to "detach" the debugger from the debuggee.

Other DAP clients (e.g. Visual Studio?) might support the terminateDebuggee property.

@weinand weinand added *as-designed Described behavior is as designed and removed new release labels Feb 8, 2021
@zobo
Copy link
Contributor Author

zobo commented Feb 8, 2021

However unfortunate, it is what it is. Thank you for clearing this up.

@weinand
Copy link
Contributor

weinand commented Feb 9, 2021

Please feel free to turn this issue into a feature request by proposing what VS Code should offer to make use of the terminateDebuggee property.

@weinand
Copy link
Contributor

weinand commented Feb 9, 2021

BTW, there is another related DAP feature request: microsoft/debug-adapter-protocol#175

@zobo
Copy link
Contributor Author

zobo commented Feb 9, 2021

Great, thanks a lot! I will check it out and make a new feature request in vscode project if what I need isn't covered by that request.

@weinand
Copy link
Contributor

weinand commented Feb 9, 2021

Please note that DAP feature requests are independent from VS Code because more clients use DAP and VS Code does not support every feature offered in DAP.

@polinasok
Copy link

I noticed the same unfortunate behavior in vscode. Setting SupportTerminateDebuggee in the adapter doesn't seem to expose any additional controls to the user. The fact that vscode doesn't use this capability is not clear. For example this update from 2017 says "An optional argument, terminateDebuggee, has been added to the disconnect request. If a debug adapter has opted into this feature with the supportTerminateDebuggee capability, a client can use this to control whether the debuggee should be terminated when the debugger is disconnected". I don't see any documentation saying that this option is ignored.

+1 to supporting this feature. In the UI this could be supported as a dropdown next to the detach button or as two different buttons.

@zobo
Copy link
Contributor Author

zobo commented Mar 19, 2021

I agree very much with @polinasok. I have also created a feature request a while back: #116731.

@weinand
Copy link
Contributor

weinand commented Mar 22, 2021

We are planning to implement feature #116731 in April.

@polinasok please note, that capabilities like SupportTerminateDebuggee do not necessarily trigger anything in a client.
The spec says:

a client can use this to control whether the debuggee should be terminated when the debugger is disconnected"

So a client can use this, but clients are not required to do so (and older clients could not even know that this feature exists).

@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*as-designed Described behavior is as designed debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

5 participants
@weinand @isidorn @zobo @polinasok and others