Open zjturner opened 7 years ago
I'd like to see this, too! :) VS has it; would like to have it in VSCode, too.
I (and the rest of the Edge team) would really love this!
I (and the rest of the Chromium community) would really love this!
Is there any update on this?
Any news here?
Any news?
Anything? Any workaround in the meantime?
I agree. This would be great.
any news?
What needs to happen for this to move forward? Which part needs to be implemented and roughly where?
It seems like this mostly works in cppdbg with gdb.
cc: @WardenGnaw
More Info:
https://github.com/microsoft/vscode-cpptools/issues/5505#issuecomment-629528619
https://github.com/microsoft/vscode-cpptools/issues/1723
I actually found something that works fairly well for my use case, the multi-process debugging in VSCode works fairly well if both processes are started via the vscode launch config. I have a dll injector, custom dll, and third party application. I start the third party application + dll injector at the same time, now. And this is working great for my purposes. Wish I found it before I spent time adding CreateProcess support into my dll injector!
Any update on this?
I have the main process launch the same executable with different command line options as child process, the "Microsoft Child Process Debugging Power Tool" for Visual Studio works well, hope VS Code could have this feature as well.
Is this still not implemented? That's disappointing. Now I have to futz around with the gdb debugger to do something that's apparently so basic.
EDIT: Oh, AND the vsdbg is closed source, so no one else can add this feature ether?! Jesus Christ, guys, what the hell??
this is WAY overdue. shame.
How is this still not implemented?
Hello, excuse me.
The background is that I use vscode to debug chromium's CPP code, and chromium is a multi-process project. In addition, with the development of society, multi process design is also being widely adopted by apps.
When the user needs to debug a bug, but it is not clear which process it will appear in or a sub-process will die soon, so I hope vscode can automatically attach to the child process. Or when users want to debug scenarios with multiple subprocesses, it can be more convenient. But now vscode can only manually attach one by one.
Fig. 1. vscode cannot automatic attach subprocess, but only manually attach one by one.
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach Debug",
"type": "cppvsdbg", // "cppdbg" for GDB/LLDB, "cppvsdbg" for Windows Visual Studio debugger
"request": "attach",
"processId": "${command:pickProcess}",
"args": [],
"stopAtEntry": false,
"environment": [],
"console": "externalTerminal",
}
]
}
Fig. 2. launch.json
Thanks.
Cc: @WardenGnaw, @sean-mcmanus
@michelleangela @sean-mcmanus do you know how likely it is we will see any development on this? It's very much needed for multi-process applications like chromium plus others. Trying to debug is painful without it.
VSCode already supports multi process, debugging js on chrome for example now shows you each tab. So it’s just for this extension to support it.
@WardenGnaw is one of the team members who works on the debugger portion of the extension. @WardenGnaw are there any plans for child process debugging?
@xisui-MSFT may have an idea also as they seem to have been doing some work in the same area
Andrew didn't respond yet...I'll ping him...
Hey @sean-mcmanus how did you get on pinging Andrew?
@jasonwilliams There is no additional news/update on this issue.
I also urgently need this feature. I use vscode to debug Chromium, which feels much smoother than on Visual Studio 2019, but cannot support sub processes, which is troublesome.
My understanding is it calls into vsdbg.exe
which is the VS Debugger. But I don't see Visual Studio ever call into this binary when debugging, so is vsdbg specifically for vscode?
Either way, I'm guessing support needs to happen there (but it's closed source). Visual Studio does support child process debugging so I don't understand how that has the capabilities but this doesn't, are they using the same underlying debugger? If so, does this just need to be surfaced at VSCode level? Is this doable via the Debug Adaptor Protocol?
My understanding is it calls into
vsdbg.exe
which is the VS Debugger. But I don't see Visual Studio ever call into this binary when debugging, so is vsdbg specifically for vscode?
My understanding is that the analog binary for Visual Studio is msvsmon.exe
. But underneath both use the "VSDebugEngine" (i.e. for debugging Windows binaries, aka. the cppvsdbg
debugger type in VS Code. If debugging on Linux or with gdb/lldb in general, as far as I know, thinks work differently).
Anyways, it is possible to write extensions to that debugging engine that work in both VS as well as VS Code (see https://github.com/microsoft/ConcordExtensibilitySamples). And I think the "Child Process Debugging Power Tool 2022" extension for VS does actually employ such a "Concord extension", that in theory should work for VS Code as well. But unfortunately the concord extension is only half the story, because when the extension figures out that a child process has launched and it wants to attach to it, it needs to pass that information to the editor, and to my understanding that is currently missing in vscode-cpptools
(or vsdbg.exe
. I am note sure exactly sure about that part).
I do have a (very rough) prototype of such a concord extension that works with VS Code. The basic idea is that it internally sets a breakpoint at CreateChildProcess
(and similar) calls and reads the returned PID after the call finished. Hence it knows the process it needs to attach to. But when I want to make VS Code attach to that process via the API call DkmDebugProcessRequest I do get a "not implemented" error for VS Code. I implemented some ugly workarounds that kind of work, but due to the communication between the concord extension and VS Code being limited, I run in several other problems that I could not resolve yet.
If there is interest, I can open source what I have so far, but as I said it is all very rough prototypes, is not usable at the moment and I am not sure when I will be able to continue working on it.
@albertziegenhagel that's incredible, thanks for the explanation, and yes, I would be interested in seeing it, even if it is unfinished. I doubt I'd be able to help much but there may be others in this thread who can!
I have pushed the code for the "Concord" extension to
https://github.com/albertziegenhagel/childdebugger-concord
and the regular VS Code extension that is supposed to work together with the Concord extension can be found at
https://github.com/albertziegenhagel/childdebugger-vscode
As I said: These are just prototypes! But if anyone wants to pick that work up or has any questions, feel free to open issues there.
And of course I would be more than happy if anyone from Microsoft (or just anyone for that matter) who has a deeper understanding of how the debug engine extension can work together with the actual VS Code extension could give any hints how to make all that a "production ready" implementation.
仍然没有新进展
Any news?
Hi. Any update on this?
Do you have instructions on how to setup the concord extension? Did you build it then put the binary in a particular directory? It would be great if you had some steps on how we can test these out
Both projects do actually have pre-build binaries in their respective GitHub releases (but of course you could build them from source if you want. There is no documentation on how to build from source yet, but the Github action workflows should give you a good idea of what needs to be done).
Additionally, I have just added a very rough getting started guide to the README of the vscode extension project which you can find here:
https://github.com/albertziegenhagel/childdebugger-vscode?tab=readme-ov-file#getting-started
Let me know if there are any issues or something is unclear.
If anyone arrives here, the instructions do work for me (building Chromium). Massive thank you to @albertziegenhagel !
It would be great if we could get this added upstream.
Thread: https://github.com/albertziegenhagel/childdebugger-vscode/issues/8
Ditto, @jasonwilliams, I too was able to use @albertziegenhagel's Child Process Debugger extension to launch an MPI debugging session on a complex commercial console application. Looking forward to seeing this published, hopefully with better integration in the VSCode UI and, someday, Linux (gdb/lldb) support. That would make it a game-changer! Thank you, I really appreciate the effort already invested into this!
crazy~
WinDbg has the
.childdbg
option which will automatically cause the debugger to attach to child processes when the parent callsCreateProcess
.GDB has a similar option, where you can set it to follow forks. #511 is related, and a workaround is offered in the comments to enable setting the follow fork mode to on. But this is not the ideal solution, because it doesn't provide any solution for the Windows Debug Engine,
cppvsdbg
. It would be nice if thelaunch.json
configuration supported a simple boolean variable,debugChildProcess
which you could set to true or false. By default it'sfalse
, and the user can override it.