ぷろじぇくと、みすじら。

Filtered by Tag: Debug

WinDbg/CDBで.loadby sos mscorwksしてSOSデバッガ拡張コマンドを使うとmscorwks.dll/mscordacwks.dllのバージョンが違うと怒られる

Created at:

Windows Server 2003 環境の.NET FrameworkとWindows Vista SP2の.NET Frameworkは微妙にバージョンが違ったりします(W2k3は最新で2.0.50727.4016、Vistaは2.0.50727.3053)。

そんな感じで手元とは異なった環境で取ったメモリダンプファイルを開いて、SOSデバッガ拡張でのぞき見ようとすると次のようにエラーになったりします。

0:023> .loadby sos mscorwks
0:023> !DumpHeap
*********************************************************************
* Symbols can not be loaded because symbol path is not initialized. *
*                                                                   *
* The Symbol Path can be set by:                                    *
*   using the _NT_SYMBOL_PATH environment variable.                 *
*   using the -y  argument when starting the debugger. *
*   using .sympath and .sympath+                                    *
*********************************************************************
PDB symbol for mscorwks.dll not loaded
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 mscorwks.dll is 
                in the version directory
            3) or, if you are debugging a dump file, verify that the file 
                mscordacwks___.dll is on your symbol path.
            4) you are debugging on the same architecture as the dump file.
                For example, an IA64 dump file must be debugged on an IA64
                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 mscorwks.dll as well.
0:023> .cordll
CLR DLL status: ERROR: Unable to load DLL mscordacwks_x86_x86_2.0.50727.3053.dll, Win32 error 0n2
0:023> .load C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
0:023> .cordll -ve -u -l
CLR DLL status: No load attempts
0:023> !DumpHeap
CLRDLL: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscordacwks.dll:2.0.50727.4016 f:0
doesn't match desired version 2.0.50727.3053 f:0
CLRDLL: Unable to find mscordacwks_x86_x86_2.0.50727.3053.dll by mscorwks search
CLRDLL: Unable to find 'mscordacwks_x86_x86_2.0.50727.3053.dll' on the path
CLRDLL: Unable to find mscorwks.dll by search
CLRDLL: ERROR: Unable to load DLL mscordacwks_x86_x86_2.0.50727.3053.dll, Win32 error 0n2
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 mscorwks.dll is 
                in the version directory
            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 the same architecture as the dump file.
                For example, an IA64 dump file must be debugged on an IA64
                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 mscorwks.dll as well.

そんなときは対応するDLLを取得できるようにシンボルパスを設定してあげます。

WinDbg の File → Symbol File Path ... で Symbol path: に

symsrv*symsrv.dll*c:\localcache*http://msdl.microsoft.com/download/symbols

Reload チェックボックスをオンでOKで閉じます。

もしすでに .loadby sos mscorwks を実行して怒られたあとなら、一度次のコマンドで再読み込みできるようにします。

.cordll -ve -u -l

あとは普通にデバッガ拡張コマンドが使えるようになってるはずです。