【发布时间】:2014-04-23 01:34:19
【问题描述】:
我需要使用 WinDbg 调试 32 位托管应用程序,但是 WinDbg 顽固地拒绝加载 SOS.dll 扩展。经过多次互联网搜索和尝试后,我被难住了。我有使用 WinDbg 调试非托管代码的经验,但这是我第一次尝试使用托管。
当我指示 WinDbg 加载默认的 SOS.dll 时,会出现以下错误:
sxe ld clr <- I wait until the clr has loaded
.loadby sos clr
The call to LoadLibrary(C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos) failed, Win32 error 0n193
"%1 is not a valid Win32 application."
Please check your debugger configuration and/or network access.
如果我尝试指定 SOS.dll,则会收到不同的错误:
.load C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos clr
The call to LoadLibrary(C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos clr) failed, Win32 error 0n126
"The specified module could not be found."
Please check your debugger configuration and/or network access.
我的设置是通过串行连接的 VM 到 VM,并且两个 VM 都是 Windows Server 2008 R2 SP1。 两个 VM 中都安装了 Windows (x64) 调试工具。
注意:似乎在较新的 Windows 操作系统中不可能(也没有必要)按照this solution 中的建议在 x64 CPU 上安装 x86 调试工具,因此请不要建议这样做。安装程序失败并出现错误。
提前感谢您的想法。
【问题讨论】:
-
什么错误信息?我在 win7 64bit 上看到了大量的 x86 windbg 安装
-
.load只采用 SOS 的路径,而不是最后的clr。如果 x86 安装程序失败,请重新下载。这里需要x86版本,因为不能将32位DLL加载到64位进程中。 -
My setup is VM-to-VM over serial connection。为什么是两个虚拟机?你准备好内核调试了吗? -
请注意,“找不到指定的模块”是由于路径中缺少转义,加倍反斜杠会产生与以前相同的“不是有效的 Win32 应用程序”错误。
标签: windbg