可以使用 Visual Studio 来调试 WinDBG 之类的子进程吗? [英] Can Visual Studio be made to debug child processes like WinDBG?

查看:40
本文介绍了可以使用 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 中,我可以使用 .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:

  1. 使用这个宏,它来自 Chrome 团队,需要处理大量子进程调试.
  2. 将您的子进程置于图像执行选项以便它们将在调试器中自动打开.然后选择 Visual Studio 的当前活动实例.
  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.

这篇关于可以使用 Visual Studio 来调试 WinDBG 之类的子进程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆