Why psscor4 command will not run

只愿长相守 提交于 2019-12-09 17:58:51

问题


For some reason, I cannot run any commands once I load psscor4. I have downloaded x64 of psscor4 from MS website and put it in same folder where windbg is. Before loading psscor4, I can run sos commands fine without any problem.

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

Once I load psscor4, I cannot run any sos commands

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

I can run these commands after prefixing sos. So !sos.do works fine. But problem is that I cannot run any psscor4 specific commands either. Any idea what could be wrong? I think the error that psscor4 outputting is misleading as I don't think any GC is happening when I attached windbg to this process.

EDIT Below is the configuration used for .NET 4.0. Which one of these could be used with psscor4 then?


回答1:


PSSCOR4

You have .NET 4.0.30319.34011, which actually is .NET 4.5. PSSCOR4 is from 2011-02-01 and not available for .NET 4.5 yet. It only works with .NET 4.0, so it's quite useless for your situation.

Since .NET 4.5 is an inplace update for .NET 4, setting the target framework to 4.0 does not help. It depends on the .NET version that is actually installed on the PC which runs your application.

Multiple extensions

Some extensions may have the same commands as other extensions. You can find the available commands of PSSCOR 4 by

0:000> .extmatch /e *psscor4* *

As you can see from the list, PSSCOR4 is a superset of SOS and has all commands of SOS plus some more.

The naming conflict can be resolved in two ways:

  1. defining the default DLL using .setdll <dllname>
  2. being explicit using !<extension>.<command>

Doing an !sos.do you chose approach 2.




回答2:


The dump is running CLR v4.5 (4.0.30319.34011). Psscor4 does not work with .NET 4.5+.



来源:https://stackoverflow.com/questions/25980945/why-psscor4-command-will-not-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!