[Debug] VisualStudio 如何实现同时调试主程序以及其启动的子进程?(仅支持VS2013及其以上版本)

原文链接:https://blogs.msdn.microsoft.com/devops/2014/11/24/introducing-the-child-process-debugging-power-tool/

We’ve heard your feedback that you want the Visual Studio debugger to support child process debugging. Child process debugging means that when the application you are debugging creates another process, Visual Studio will detect this and automatically attach a debugger to the newly created process as well. To address this we’re releasing a power tool for Visual Studio that will enable you to do just this. Some important things to note:

  • Download the tool from the Visual Studio Gallery
  • The power tool requires at least Visual Studio 2013 Update 2 (will work with any higher update version and Visual Studio 2015)
  • The tool works for both launching projects (F5), and for attaching to processes
  • It requires a native debugger. This means if you are debugging .NET code, you must choose to enable mixed mode debugging (so managed and native)—this is done from the “Debug” tab on the project properties page (for most managed project types this is done by checking the “Enable native code debugging” checkbox under the “Enable debuggers” section of the page)

Once you install the power tool from the Visual Studio Gallery, a new menu item will appear on the “Debug” menu under the “Other Debug Targets” sub-menu.

clip_image002

When you open the settings page, you’ll see a checkbox to enable child process debugging. To turn the feature on, check this and click “Save”. Child process debugging is now enabled for all child processes, and will by default use the same debug engine settings you are debugging the parent process with (e.g. native only, or mixed mode).

clip_image004

 

If you want to customize any settings this tool give you the ability to do that.

  • You can change the “Debugger Type” column to a specific debug engine rather than inheriting the same settings that you are debugging the parent process with
  • You can add additional rows to customize the behavior for a specific process. For example:
    • If your process spawns multiple child processes but you only want to debug a single one (e.g. “specialprocess.exe”, you can add a row for that and then set the action for the “<All other processes>” row to “Do not debug”
    • If you spawn some managed and some native process, you can configure child process debugging to use the specific debug engine (“Debugger Type”) for each process rather than mixed mode debugging them both
  • Once you have finished configuring your settings remember to click the “Save” button to persist them

clip_image006

Finally the “Persist settings to:” dropdown gives you the ability to save your settings. The default behavior will be to add it your solution’s .suo file (e.g. breakpoints are stored here). However you can optionally choose to export them to an XML file.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值