从 Visual Studio 使用 Windbg
是否可以从 Visual Studio 命令窗口(在调试会话中)使用像 !locks
和 .loadby sos mscorwks
这样的 Windbg 命令?我注意到我可以使用例如 k
来打印堆栈跟踪,所以我想知道是否有某种方法可以访问其他命令。
Is it possible to use windbg commands like !locks
and .loadby sos mscorwks
from the Visual Studio command window (in a debug session)? I've noticed I can use eg k
to print a stack trace, so I was wondering if there is some way to get access to the other commands.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 Windows 驱动程序开发工具包 (WDK) 8.0 开始,Windows 调试器集成到 Visual Studio 中(请参阅 调试环境)。在 Visual Studio 安装之上安装 WDK 将使开发人员能够从“附加到进程”对话框中选择多个调试器,或在项目的“调试器”中设置调试引擎设置。这已经在 Visual Studio 2012 和 2013 中得到了验证。按照我阅读上面的 MSDN 链接的方式,这也应该适用于 WDK 8.0 及更高版本支持的任何其他 IDE。
虽然 WinDbg 提供了许多强大的命令,但也存在一些缺点。此列表并不详尽,仅包含我遇到的那些问题:
.sympath
设置的配置。Starting with Windows Driver Development Kit (WDK) 8.0 the Windows debugger is integrated into Visual Studio (see Debugging Environments). Installing the WDK on top of a Visual Studio installation will enable a developer to pick a number of debuggers from the Attach to Process dialog, or set the debugging engine in a project's Debugger settings. This has been verified for Visual Studio 2012 and 2013. The way I read the MSDN link above, this should also work for any other IDE that is supported by the WDK 8.0 and above.
While WinDbg offers a lot of powerful commands, there are some drawbacks as well. This list is not exhaustive, and merely contains those issues I did encounter:
.sympath
.Visual Studio 2012 在“附加到进程”对话框中具有“Windows 用户模式调试器”传输。这允许您在立即窗口中使用 Windbg 命令。
来源:在 Visual Studio 用户模式调试中使用 WinDbg 引擎
Visual Studio 2012 has the "Windows User Mode Debugger" transport in the "Attach to Process" dialog. This allows you to use windbg commands in the immediate window.
Source: Use the WinDbg Engine in Visual Studio User-Mode Debugging
是的,你可以这样做。
!load sos
!EEHeap,!DumpHeap
有一些条件。您需要在项目属性中启用非托管代码调试。通常 64 位版本的 studio 不支持此功能。
玩得开心。
Yes you can do this.
!load sos
!EEHeap,!DumpHeap
There are some conditions. You need to enable unmanaged code debugging in your project properties. Normally in 64 bit version studio doesn't support this.
Have fun.