如何在Windbg中为在64位服务器上运行的32位应用程序加载SOS

时间:2014-11-17 14:07:57

标签: .net windbg sos

尝试调试在64位Windows版本上运行的32位.NET应用程序的进程转储使用调试程序6.3.9600.16384 x86。

花了几个小时寻找解决方案。在stackoverflow和其他网站上找到了很多主题,但是我无法解决这个问题。我准备把头发拉出来。

检查进程正在使用的.NET版本

0:000> lmv m clr
start    end        module name
618a0000 61f3b000   clr        (pdb symbols)          c:\symcache\clr.pdb\5182A0CFB60D40DB90EEF44DEC7ACB932\clr.pdb
    Loaded symbol image file: clr.dll
    Mapped memory image file: c:\symcache\clr.dll\52717E8469b000\clr.dll
    Image path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
    Image name: clr.dll
    Timestamp:        Wed Oct 30 22:47:48 2013 (52717E84)
    CheckSum:         0069CCD3
    ImageSize:        0069B000
    File version:     4.0.30319.18444
    Product version:  4.0.30319.18444
    File flags:       8 (Mask 3F) Private
    File OS:          4 Unknown Win32
    File type:        2.0 Dll
    File date:        00000000.00000000
    Translations:     0000.04b0 0000.04e4 0409.04b0 0409.04e4

将运行应用程序的服务器上的clr.dll,mscordacwks.dll和SOS.dll复制到C:\ Temp \ Dlls。将mscordacwks.dll重命名为mscordacwks_x86_x86_4.0.30319.18444.dll。

0:000> .cordll -u -lp c:\temp\dlls -ve
CLRDLL: Unable to get version info for 'c:\temp\dlls\mscordacwks.dll', Win32 error 0n87
CLRDLL: Unable to get version info for 'c:\temp\dlls\SOS_x86_x86_4.0.30319.18444.dll', Win32 error 0n87
Cannot Automatically load SOS
CLRDLL: Loaded DLL c:\temp\dlls\mscordacwks_x86_x86_4.0.30319.18444.dll
CLR DLL status: Loaded DLL c:\temp\dlls\mscordacwks_x86_x86_4.0.30319.18444.dll

0:000> .loadby sos clr
0:000> !clrstack
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            2) the file mscordacwks.dll that matches your version of clr.dll is 
                in the version directory or on the symbol path
            3) or, if you are debugging a dump file, verify that the file 
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            4) you are debugging on supported cross platform architecture as 
                the dump file. For example, an ARM dump file must be debugged
                on an X86 or an ARM machine; an AMD64 dump file must be
                debugged on an AMD64 machine.

You can also run the debugger command .cordll to control the debugger's
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to clr.dll as well.

尝试设置可执行路径

0:000> .exepath c:\temp\dlls
Executable image search path is: c:\temp\dlls
Expanded Executable image search path is: c:\temp\dlls

************* Symbol Path validation summary **************
Response                         Time (ms)     Location
OK                                             c:\temp\dlls
0:000> .reload
................................................................
..........................................................
Loading unloaded module list
.....
0:000> !clrstack
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            2) the file mscordacwks.dll that matches your version of clr.dll is 
                in the version directory or on the symbol path
            3) or, if you are debugging a dump file, verify that the file 
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            4) you are debugging on supported cross platform architecture as 
                the dump file. For example, an ARM dump file must be debugged
                on an X86 or an ARM machine; an AMD64 dump file must be
                debugged on an AMD64 machine.

You can also run the debugger command .cordll to control the debugger's
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to clr.dll as well.

试过.loadby sos clr

0:000> .loadby sos clr
0:000> !clrstack
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            2) the file mscordacwks.dll that matches your version of clr.dll is 
                in the version directory or on the symbol path
            3) or, if you are debugging a dump file, verify that the file 
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            4) you are debugging on supported cross platform architecture as 
                the dump file. For example, an ARM dump file must be debugged
                on an X86 or an ARM machine; an AMD64 dump file must be
                debugged on an AMD64 machine.

You can also run the debugger command .cordll to control the debugger's
load of mscordacwks.dll.  .cordll -ve -u -l will do a verbose reload.
If that succeeds, the SOS command should work on retry.

If you are debugging a minidump, you need to make sure that your executable
path is pointing to clr.dll as well.

谁能帮帮我?不知道我还能尝试什么。

2 个答案:

答案 0 :(得分:0)

你做了很多事情:

  1. 您使用WER LocalDumps
  2. 对32位应用程序进行了32位转储
  3. 您已复制原始PC中的SOS和mscordacwks
  4. 您已正确重命名
  5. 您选择了32位WinDbg
  6. 您已使用.cordll并且已加载正确的mscordacwks DLL
  7. 只有一件小事出了问题:

    .loadby sos clr
    

    此命令将从clr.dll所在的同一位置加载SOS。这将在您的PC上确定,因此这可能会加载不同于转储中存在的SOS版本。

    相反,提供从PC收集的SOS的完整路径:

    .load c:\temp\dlls\sos.dll
    

答案 1 :(得分:-1)

您是如何创建转储文件的? 如果您在64位窗口上调试32位进程,则必须使用位于

的32位版本的任务管理器
  

C:\的Windows \ Syswow64资料\的TaskMgr.exe

然后右键单击该流程并创建转储文件&#39;

一旦你采取了正确的转储,就在转储机器上的WinDbg(X64)中打开它 - 如果可能的话,在远程PC上安装windbg,因为这样可以减少调试问题,如果你有不同的版本(甚至是微妙的).NET框架