【问题标题】:Why psscor4 command will not run为什么 psscor4 命令不会运行
【发布时间】:2014-09-22 18:37:39
【问题描述】:

由于某种原因,一旦加载 psscor4,我就无法运行任何命令。我已经从 MS 网站下载了 x64 的 psscor4 并将其放在 windbg 所在的同一文件夹中。在加载 psscor4 之前,我可以正常运行 sos 命令,没有任何问题。

0:003> .loadby sos clr

0:003> lmvm clr
start             end                 module name
00007ffa`35630000 00007ffa`35fc8000   clr        (deferred)             
    Image path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
    Image name: clr.dll
    Timestamp:        Wed Nov 27 19:25:30 2013 (52968D7A)
    CheckSum:         00996ED8
    ImageSize:        00998000
    File version:     4.0.30319.34011
    Product version:  4.0.30319.34011
    File flags:       8 (Mask 3F) Private
    File OS:          4 Unknown Win32
    File type:        2.0 Dll
    File date:        00000000.00000000
    Translations:     0409.04b0
    CompanyName:      Microsoft Corporation
    ProductName:      Microsoft® .NET Framework
    InternalName:     clr.dll
    OriginalFilename: clr.dll
    ProductVersion:   4.0.30319.34011
    FileVersion:      4.0.30319.34011 built by: FX45W81RTMGDR
    PrivateBuild:     DDBLD109
    FileDescription:  Microsoft .NET Runtime Common Language Runtime - WorkStation
    LegalCopyright:   © Microsoft Corporation.  All rights reserved.
    Comments:         Flavor=Retail

    0:003> !DumpHeap -type ConsoleApplication1.Dummy
         Address               MT     Size
0000000002022f58 00007ff9d5ec4130       40     

Statistics:
              MT    Count    TotalSize Class Name
00007ff9d5ec4130        1           40 ConsoleApplication1.Dummy
Total 1 objects

0:003> !DumpHeap -mt 00007ff9d5ec4130
         Address               MT     Size
0000000002022f58 00007ff9d5ec4130       40     

Statistics:
              MT    Count    TotalSize Class Name
00007ff9d5ec4130        1           40 ConsoleApplication1.Dummy
Total 1 objects

0:003> !do 0000000002022f58 
Name:        ConsoleApplication1.Dummy
MethodTable: 00007ff9d5ec4130
EEClass:     00007ff9d5fd23b8
Size:        40(0x28) bytes
File:        c:\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007ffa34635740  4000001        8        System.Byte[]  0 instance 0000000012029740 bytes
00007ffa34632838  4000002       18         System.Int32  1 instance                0 <ID>k__BackingField
00007ffa3464d5b8  4000003       10        System.Double  1 instance 0.000000 <SomeThing>k__BackingField

加载 psscor4 后,我无法运行任何 sos 命令

0:003> .load psscor4
0:003> !DumpHeap -type ConsoleApplication1.Dummy
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

0:003> !DumpHeap -mt 00007ff9d5ec4130
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

0:003> !do 0000000002022f58 
<Note: this object has an invalid CLASS field>
Invalid object

我可以在添加 sos 前缀之后运行这些命令。所以 !sos.do 工作正常。但问题是我也无法运行任何 psscor4 特定命令。知道有什么问题吗?我认为 psscor4 输出的错误具有误导性,因为当我将 windbg 附加到此进程时,我认为不会发生任何 GC。

编辑 下面是用于 .NET 4.0 的配置。那么其中哪一个可以与 psscor4 一起使用?

【问题讨论】:

  • 查看我的更新答案:由于 .NET 4.5 是 .NET 4 的就地更新,因此将目标框架设置为 4.0 无济于事。这取决于运行您的应用程序的 PC 上实际安装的 .NET 版本。

标签: c# .net windbg sos sosex


【解决方案1】:

PSSCOR4

您有 .NET 4.0.30319.34011,它实际上是 .NET 4.5。 PSSCOR4 是从 2011-02-01 开始的,目前还不能用于 .NET 4.5。它仅适用于 .NET 4.0,因此对您的情况毫无用处。

由于 .NET 4.5 是 .NET 4 的就地更新,将目标框架设置为 4.0 并没有帮助。这取决于运行您的应用程序的 PC 上实际安装的 .NET 版本。

多个扩展

某些扩展程序可能与其他扩展程序具有相同的命令。您可以通过

找到 PSSCOR 4 的可用命令
0:000> .extmatch /e *psscor4* *

从列表中可以看出,PSSCOR4 是 SOS 的超集,并且包含 SOS 的所有命令以及更多命令。

命名冲突可以通过两种方式解决:

  1. 使用.setdll &lt;dllname&gt;定义默认DLL
  2. 明确使用!&lt;extension&gt;.&lt;command&gt;

做一个!sos.do 你选择了方法2。

【讨论】:

  • 据我所知,我从项目属性选项中选择了 .NET 4.0。请查看有问题的图片(刚刚添加)
【解决方案2】:

转储正在运行 CLR v4.5 (4.0.30319.34011)。 Psscor4 不适用于 .NET 4.5+。

【讨论】:

  • 这有点令人困惑:) 我添加了一些有问题的细节。你能澄清一下吗?
  • .NET Framework 4 将是 PSSCOR4 兼容的唯一目标。每当您调试转储并且 v4 版本号在最后一位有五位数字时,您使用的是 .NET 4.5+,PSSCOR4 将无法工作。
猜你喜欢
  • 2012-02-14
  • 1970-01-01
  • 1970-01-01
  • 2018-09-29
  • 1970-01-01
  • 2016-04-26
  • 1970-01-01
  • 2020-01-21
  • 1970-01-01
相关资源
最近更新 更多