Visual Studio可以调试诸如WinDBG之类的子进程吗?
这与此问题类似,但我想要把它弄脏一点。 (我是新来的,如果我应该改为对上一个问题做一个碰撞的答案,请让我知道。)
This is similar to this question, but I wanted to flesh it out a bit. (I'm new here, if I should instead do a "bump" answer on the previous question instead, please let me know.)
在WinDBG中,我可以使用code> .childdbg 1 命令告诉它在子进程生成时中断,或者我可以使用 -o
命令行选项。这在某些情况下非常有用,所以令人惊讶的是(据我所见)Visual Studio不支持它。看起来应该很清楚CreateProcess()上的 DEBUG_PROCESS_ONLY_THIS_PROCESS
标志,VS已经支持调试多个进程。
In WinDBG, I can use the .childdbg 1
command to tell it to break when a child process is spawned, or I can launch it with the -o
command-line option. This is very useful in some situations, so it's surprising that (as far as I can see) Visual Studio doesn't support it. It seems like it ought to be pretty easy to clear the DEBUG_PROCESS_ONLY_THIS_PROCESS
flag on CreateProcess(), and VS already supports debugging multiple processes.
所以,我在Visual Studio中缺少一些选项来启用此功能?如果没有,是否有技术理由为什么他们选择不支持它?
So, am I missing some option in Visual Studio to enable this? If not, is there a technical rationale for why they have chosen not to support it?
不可能(AFAIK,任何许多其他...),但您有几种解决方法:
Not possible (AFAIK, any many others...) but you have several workarounds:
- Use this macro, it comes from the Chrome team which need to deal with a lot of child processes debugging.
- Put your child process on Image Execution Options so that they will automatclly open in a debugger. Then select the current active instance of Visual Studio.