【问题标题】:Set up WinDbg as the default debugger将 WinDbg 设置为默认调试器
【发布时间】:2011-04-12 16:02:55
【问题描述】:

每当我的应用程序抛出未处理的异常时,我希望 WinDbg 在我的调试机器上捕获该异常,而不是 Dr. Watson 等。如何配置?

【问题讨论】:

    标签: windbg


    【解决方案1】:

    运行windbg -I 将其安装在默认的事后调试器中。

    正如 Kurt 在下面指出的那样,WinDbg 有 32 位和 64 位版本。执行windbg -I 会为与调试器位数对应的进程设置事后调试器。

    如果您需要同时提供 32 位和 64 位版本,您可以并排安装这两个版本的 WinDbg。

    来自帮助文件:

    -I[S] 安装 WinDbg 作为事后调试器。有关详细信息,请参阅 启用事后调试。后 尝试此操作,成功或 显示失败消息。如果 S 是 包括,此过程已完成 如果成功则静默;只要 显示失败消息。 -我 参数不得与任何 其他参数。该命令将 实际上并没有启动 WinDbg,虽然一个 WinDbg 窗口可能会出现片刻。

    【讨论】:

    • 表示注册成功,但再次启动崩溃过程仍会导致 Visual Studio Just-In-Time 窗口显示只有 Visual Studio 调试器可用。 :(哦,好吧。
    • @SilverbackNet:Windbg 有 32 位和 64 位两种版本。如果您使用 -I 参数运行 32 位版本,它将自己设置为 32 位进程的默认调试器。如果您运行 64 位版本,它会将自己设置为 64 位进程的默认调试器。因此,如果您仍然看到 Visual Studio 调试器选择窗口,则可能是您没有使用 -I 运行正确的 windbg 位数。见this MSDN article
    • 我记得最近在 [windbg] 上的一些帖子,其中阐明了哪个位会覆盖哪个位(但反之则不然)。
    【解决方案2】:

    这是一个注册表文件,用于将 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 团队的一篇文章。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-06
      • 1970-01-01
      • 2019-02-27
      • 1970-01-01
      • 2011-12-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多