我正在实时调试 session 中调试 Microsoft Word。该过程会加载一些托管加载项,因此我使用 sos 和 psscor4。进程 winword.exe 是一个 32 位进程,但托管加载项将 MSIL 作为其 PlatformArchitecture 枚举的值,这意味着它们可以在任何平台上编译为 JITT。
我正在使用 Windbg (x86)。
一旦我从 C:\Windows\Microsoft.NET\Framework\v4.0.30319 目录加载 psscor4,然后尝试任何与 GC 相关的命令,例如 !clrusage
命令,我收到此消息:
The garbage collector data structures are not in a valid state for traversal. It is either in the "plan phase," where objects are being moved around, or we are at the initialization or shutdown of the gc heap. Commands related to displaying, finding or traversing objects as well as gc heap segments may not work properly. !dumpheap and !verifyheap may incorrectly complain of heap consistency errors. Error requesting GC Heap data Unable to build snapshot of the garbage collector state.
在加载psscor4期间,连GC相关的sos命令都不起作用。例如,如果我运行 heapstat
、dumpheap
或 eeheap -gc
命令,它们不起作用。
我一卸载 psscor4,它们就会恢复工作。
最佳答案
PSSCOR 可能不适用于您的情况,因为您的插件使用 .NET 4.5 和 PSSCOR4 was not built for .NET 4.5 。您可以使用lm vm clr
检查.NET版本。如果显示 4.0.30319.18401 或更高版本,则为 .NET 4.5。
!heapstat
、!dumpheap
和 !eeheap
不起作用,因为 PSSCOR4 带来了这些命令的自己的版本。您可以使用 .extmatch/e *psscor4* *
命令进行验证。
这取决于加载扩展的顺序,哪一个是默认的。您可以使用 .chain
显示加载的扩展,默认扩展位于顶部。您可以使用 .setdll
将不同的扩展设置为默认扩展。
如果您不想更改默认扩展名,您还可以显式定义要与 !sos.heapstat
等一起使用的 SOS 扩展名。
关于.net - 加载 psscor4 : The garbage collector data structures are not in a valid state for traversal 时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43332099/