Can Visual Studio be made to debug child processes like WinDBG?
Asked Answered
O

2

40

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.)

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.

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?

Olympiaolympiad answered 21/4, 2009 at 4:30 Comment(0)
A
22

Not possible (AFAIK, any many others...) but you have several workarounds:

  1. Use this macro, it comes from the Chrome team which need to deal with a lot of child processes debugging.
  2. 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.
Alrick answered 21/4, 2009 at 8:3 Comment(2)
The "Use this macro" links appear to be broken -- could you update the answer to include the macro instead of linking to it?Carlo
Neither of the links appear to reference anything useful now. This is exactly why link-centric answers aren't great.Acerbic
T
41

There is now a power tool that lets you attach to child process: Introducing The Child Process Debugging Power Tool

Child process debugging menu

Taliped answered 22/5, 2015 at 22:1 Comment(0)
A
22

Not possible (AFAIK, any many others...) but you have several workarounds:

  1. Use this macro, it comes from the Chrome team which need to deal with a lot of child processes debugging.
  2. 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.
Alrick answered 21/4, 2009 at 8:3 Comment(2)
The "Use this macro" links appear to be broken -- could you update the answer to include the macro instead of linking to it?Carlo
Neither of the links appear to reference anything useful now. This is exactly why link-centric answers aren't great.Acerbic

© 2022 - 2024 — McMap. All rights reserved.