albertziegenhagel / childdebugger-vscode

VS Code extension to auto-attach a debugger to child processes for `cppvsdbg`.
MIT License
4 stars 0 forks source link

Support new targets (CDP/VS Code) instead of new debugging sessions for each process #5

Open jasonwilliams opened 2 months ago

jasonwilliams commented 2 months ago

My understanding is this extension abuses the startDebugging API call to make a new session for each process it finds.

This will work to a degree but, if my experience with other extensions that tried this is to be believed[^1], this will eventually crash VS Code because it can end up spawning loads of debug session (which it's not designed for).

If its possible a better idea would be to treat each process as a new target instead, this would allow the user to have a single debug session but still see the individual processes under the call stack. This is something Chromioum does when you debug it. Here are steps to reproduce.

image

VS Code has support for multiple targets within a session, this is already working to some degree with threads (which you see when debugging Chromium). I guess we want to bunch processes in there too and have them all come down the same channel.

I don't know if its possible with this plugin or not though sadly.

[^1]: I tried this before and it just crashes VS Code, I assume because of all the new sessions it generates when debugging Chromium

albertziegenhagel commented 2 months ago

This is something I would have to investigate, since at the moment, I would not know how to create those targets.

I am mainly using this to launch mpiexec and I want it to attach to all processes that are launched by it. I think the highest number of child processes I had so far was about 20, and I did not see any kind of significant slowdown or issues in VS Code, but I was already asking myself the question how far this would scale....