问题的场景是这样的, 你在看dump文件, 运行了一个命令, 可是你觉得这个命令跟平常你看到的该命令的输出有点不大一样. 你感觉很困惑, 怀疑是不是这个命令不属于你希望的那个debugger extension. 怎么办?
比方说, psscor2.dll 和 sos.dll 都包含有一些命令, 你的debugger 又同时加载了两个debugger, 你运行了一个!threads, 却不清楚这个究竟是psscor2.dll的命令还是sos.dll的.
解决方案
===========
第一种, 明确指定debugger extension. 使用下面的格式
![DebuggerExtension].[Command] Arguments
举例:
!psscor2.threads -special
第二种, 使用.chain命令, 查看已加载的debugger extension的顺序, 谁在上面, 谁的命令就先被找到.
0:018> .chain
Extension DLL search Path:
C:\Program Files\Debugging Tools for Windows (x64)\WINXP;C:\Program Files\Debugging Tools for Windows (x64)\winext;C:\Program Files\Debugging Tools for Windows (x64)\winext\arcade;C:\Program Files\Debugging Tools for Windows (x64)\pri;C:\Program Files\Debugging Tools for Windows (x64);C:\Program Files\Debugging Tools for Windows (x64)\winext\arcade;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\Extension DLL chain:
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\sos: image 2.0.50727.4952, API 1.0.0, built Thu May 13 20:15:18 2010
[path: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\sos.dll]
psscor2: image 2.0.0.1, API 1.0.0, built Thu Mar 25 03:25:01 2010
[path: C:\Program Files\Debugging Tools for Windows (x64)\psscor2.dll]
dbghelp: image 6.11.0001.404, API 6.1.6, built Thu Feb 26 10:10:27 2009
[path: C:\Program Files\Debugging Tools for Windows (x64)\dbghelp.dll]
ext: image 6.11.0001.404, API 1.0.0, built Thu Feb 26 10:10:26 2009
[path: C:\Program Files\Debugging Tools for Windows (x64)\winext\ext.dll]
exts: image 6.11.0001.404, API 1.0.0, built Thu Feb 26 10:10:17 2009
[path: C:\Program Files\Debugging Tools for Windows (x64)\WINXP\exts.dll]
uext: image 6.11.0001.404, API 1.0.0, built Thu Feb 26 10:10:20 2009
[path: C:\Program Files\Debugging Tools for Windows (x64)\winext\uext.dll]
ntsdexts: image 6.1.7015.0, API 1.0.0, built Thu Feb 26 10:09:22 2009
[path: C:\Program Files\Debugging Tools for Windows (x64)\WINXP\ntsdexts.dll]
从上面的命令可以看出, 这里SOS.dll中的命令会先被搜索到. 因为.chain命令会按照默认的搜索顺序列出所以已经加载了的debugger extension. 所以在这样的情况下, 运行!threads命令的话, 执行的会是SOS.dll中的命令.
.chain命令的帮助信息如下:
.chain (List Debugger Extensions)
The .chain command lists all loaded debugger extensions in their default search order.