4.sos分析dump时dac报错怎么办

很多朋友在做 dump 分析时,常会遇到这个错误,截图如下:


0:000>  .load C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.dll
0:000> !t
Failed to load data access DLL, 0x80004005
Verify that 1) you have a recent build of the debugger (6.2.14 or newer)
            1) the file mscordacwks.dll that matches your version of clr.dll is 
                in the version directory or on the symbol path
            2) or, if you are debugging a dump file, verify that the file 
                mscordacwks_<arch>_<arch>_<version>.dll is on your symbol path.
            3) 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.

再截图一张:

上面的错误信息是: Failed to load data access DLL ,表示加载 dac 组件时错误。

解决办法:

  • 从 dump目标机上 copy 一份 sos 出来

    如果是 32bit 的程序,目录是: C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.dll
    如果是 64bit 的程序,目录是: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\sos.dll


0:000> .unload sos
Unloading C:\Windows\Microsoft.NET\Framework\v4.0.30319\sos.dll extension DLL
0:000> .load D:\dumps\memory-high-8\sos.dll
0:000> !t
ThreadCount:      64
UnstartedThread:  0
BackgroundThread: 52
PendingThread:    0
DeadThread:       5
Hosted Runtime:   no
                                   PreEmptive   GC Alloc                Lock
       ID  OSID ThreadOBJ    State GC           Context       Domain   Count APT Exception
   0    1  ed28 0023ede8      6020 Enabled  edbc5284:edbc6298 00238000     0 STA
   2    2  e0dc 0024ab20      b220 Enabled  ed94af3c:ed94cdd0 00238000     0 MTA (Finalizer)
   6    3  e838 15ed0b68   200b220 Enabled  00000000:00000000 00238000     1 MTA
...

是不是非常的简单,搞定!

posted @ 2023-12-06 09:24  一线码农  阅读(108)  评论(0编辑  收藏  举报