每当我的应用程序抛出未处理的异常时,我希望WinDbg在我的调试机器而不是Dr. Watson等上捕获该异常。如何配置?
答案 0 :(得分:16)
运行windbg -I
将其安装在默认的事后调试器中。
正如Kurt所指出的,WinDbg有32位和64位版本。执行windbg -I
为与调试器的位数相对应的进程设置事后调试器。
如果需要同时提供32位和64位版本,可以并排安装两个版本的WinDbg。
从帮助文件中:
-I[S]
安装WinDbg作为事后调试程序。有关详情,请参阅 启用事后调试。后 尝试这个动作,成功或 显示失败消息。如果S是 包括在内,这个程序已经完成 如果成功的话,默默地;只要 显示失败消息。 -I 参数不得与any一起使用 其他参数。这个命令会 实际上并没有启动WinDbg,虽然是 WinDbg窗口可能会出现片刻。
答案 1 :(得分:5)
这是一个用于将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团队的一篇关于此内容的文章。