【发布时间】:2011-04-12 16:02:55
【问题描述】:
每当我的应用程序抛出未处理的异常时,我希望 WinDbg 在我的调试机器上捕获该异常,而不是 Dr. Watson 等。如何配置?
【问题讨论】:
标签: windbg
每当我的应用程序抛出未处理的异常时,我希望 WinDbg 在我的调试机器上捕获该异常,而不是 Dr. Watson 等。如何配置?
【问题讨论】:
标签: windbg
运行windbg -I 将其安装在默认的事后调试器中。
正如 Kurt 在下面指出的那样,WinDbg 有 32 位和 64 位版本。执行windbg -I 会为与调试器位数对应的进程设置事后调试器。
如果您需要同时提供 32 位和 64 位版本,您可以并排安装这两个版本的 WinDbg。
来自帮助文件:
-I[S]安装 WinDbg 作为事后调试器。有关详细信息,请参阅 启用事后调试。后 尝试此操作,成功或 显示失败消息。如果 S 是 包括,此过程已完成 如果成功则静默;只要 显示失败消息。 -我 参数不得与任何 其他参数。该命令将 实际上并没有启动 WinDbg,虽然一个 WinDbg 窗口可能会出现片刻。
【讨论】:
-I 参数运行 32 位版本,它将自己设置为 32 位进程的默认调试器。如果您运行 64 位版本,它会将自己设置为 64 位进程的默认调试器。因此,如果您仍然看到 Visual Studio 调试器选择窗口,则可能是您没有使用 -I 运行正确的 windbg 位数。见this MSDN article。
这是一个注册表文件,用于将 WinDbg 设置为托管调试器和本机调试器:
Windows Registry Editor Version 5.00
;This reg file installs just-in-time debuggers to capture a dump of all process
;crashes for the machine.
;
;Assumes 32-bit debugger is cdb.exe and is installed to C:\debuggers\x86\.
;Assumes 64-bit debugger is cdb.exe and is installed to C:\debuggers\x64\.
;
;Assumes crash dumps can be written to C:\crash_dumps\.
;Make sure all users have write access to this directory.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework]
"DbgManagedDebugger"="\"c:\\debuggers\\x64\\windbg.exe\" -pv -p %ld "
"DbgJITDebugLaunchSetting"=dword:00000002
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Debugger"="\"c:\\debuggers\\x64\\windbg.exe\" -pv -p %ld "
"Auto"="1"
;The following keys are only used on 64-bit versions of Windows (note Wow6432Node).
;They can be safely created with no side-effects on 32-bit versions of Windows.
;Alternatively, you can delete the remainder of this file if you’re running a
;32-bit version of Windows.
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\AeDebug]
"Debugger"="\"c:\\debuggers\\x86\\windbg.exe\" -pv -p %ld "
"Auto"="1"
Automatically Capturing a Dump When a Process Crashes 是来自 CLR 团队的一篇文章。
【讨论】: