microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.44k stars 1.53k forks source link

Suggestion: Debugger > Detach #1696

Open niklas-ourmachinery opened 6 years ago

niklas-ourmachinery commented 6 years ago

You can attach the Debugger to a running process with an attach entry in launch.json, but as far as I can tell, there is no corresponding way to detach the debugger (similar to Visual Studio's Debug > Detach All).

There are a number of scenarios where this can be useful, e.g:

WardenGnaw commented 6 years ago

For attach, the only option should be detach. image

To help investigate why detach is not working for you could you answer the following questions:

johnknoop commented 6 years ago

It would be nice with a Detach option even if you didn't attach to a running process, but started it using Debug.

WardenGnaw commented 6 years ago

VSCode will need to add a way to detach the process in the UI. At the moment, they only support terminating a process.

polyval commented 5 years ago

@WardenGnaw Could you please tell me how can I change the behavior of the stop button so that it can detach the gdb from the process rather than terminate it. I can hit the pause button then input “-exec detach” to do it, I guess there must be somewhere in the code that I can customize the behavior. Can you help me with that? Thanks.

WardenGnaw commented 5 years ago

VS Code now has a way to contribute to the debug toolbar.

This feature will need to register a command that sends a disconnect request to the debug adapter.

shimaowo commented 3 years ago

Apologies if this is answered somewhere, but the documentation is surprisingly unclear.

Is it possible to detach from a running process when using cppvsdbg and not cppdbg? I am able to create a launch.json configuration that will successfully attach and allow me to debug normally, but if I attempt to disconnect using the UI buttons, it will always terminate the process. And the workaround for "-exec detach" obviously does not work as this isn't gdb.

This isn't an issue with the target application, as the same workflow functions properly in VS2019. It just means that vscode is seemingly unusable at the moment for workflows that rely on the ability to hot-reload libraries etc.