新版 sos 命令列表速查

0:000> !sos.help
analyzeoom, AnalyzeOOM                                   Displays the info of the last OOM that occurred on an allocation request to the GC heap.
assemblies, clrmodules                                   Lists the managed assemblies in the process.
clrstack <arguments>                                     Provides a stack trace of managed code only.
clrthreads <arguments>                                   Lists the managed threads running.
crashinfo                                                Displays the crash details that created the dump.
dbgout <arguments>                                       Enables/disables (-off) internal SOS logging.
dumpalc <arguments>                                      Displays details about a collectible AssemblyLoadContext into which the specified object is loaded.
dumparray <arguments>                                    Displays details about a managed array.
dumpassembly <arguments>                                 Displays details about an assembly.
dumpasync, DumpAsync                                     Displays information about async "stacks" on the garbage-collected heap.
dumpclass <arguments>                                    Displays information about a EE class structure at the specified address.
dumpconcurrentdictionary, dcd <address>                  Displays concurrent dictionary content.
dumpconcurrentqueue, dcq <address>                       Displays concurrent queue content.
dumpdelegate <arguments>                                 Displays information about a delegate.
dumpdomain <arguments>                                   Displays the Microsoft intermediate language (MSIL) that's associated with a managed method.
dumpexceptions                                           Displays a list of all managed exceptions.
dumpgcdata <arguments>                                   Displays information about the GC data.
dumpgen, dg <generation>                                 Displays heap content for the specified generation.
dumpheap, DumpHeap <memoryrange>                         Displays a list of all managed objects.
dumphttp, DumpHttp                                       Displays information about HTTP requests.
dumpil <arguments>                                       Displays the Microsoft intermediate language (MSIL) that is associated with a managed method.
dumplog <arguments>                                      Writes the contents of an in-memory stress log to the specified file.
dumpmd <arguments>                                       Displays information about a MethodDesc structure at the specified address.
dumpmodule <arguments>                                   Displays information about a EE module structure at the specified address.
dumpmt <arguments>                                       Displays information about a method table at the specified address.
dumpobj, do <arguments>                                  Displays info about an object at the specified address.
dumpobjgcrefs <object>                                   A helper command to implement !dumpobj -refs
dumprequests, DumpRequests                               Displays all currently active incoming HTTP requests.
dumpruntimetypes, DumpRuntimeTypes                       Finds all System.RuntimeType objects in the GC heap and prints the type name and MethodTable they refer too.
dumpsig <arguments>                                      Dumps the signature of a method or field specified by <sigaddr> <moduleaddr>.
dumpsigelem <arguments>                                  Dumps a single element of a signature object.
dumpstackobjects, dso, DumpStackObjects <stackbounds>    Displays all managed objects found within the bounds of the current stack.
dumpvc <arguments>                                       Displays info about the fields of a value class.
eeheap, EEHeap <memoryrange>                             Displays information about native memory that CLR has allocated.
eeversion <arguments>                                    Displays information about the runtime version.
ehinfo <arguments>                                       Displays the exception handling blocks in a JIT-ed method.
enummem <arguments>                                      ICLRDataEnumMemoryRegions.EnumMemoryRegions test command.
ephrefs                                                  Finds older generation objects which reference objects in the ephemeral segment.
ephtoloh                                                 Finds ephemeral objects which reference the large object heap.
finalizequeue, fq, FinalizeQueue                         Displays all objects registered for finalization.
findappdomain <arguments>                                Attempts to resolve the AppDomain of a GC object.
findpointersin <regions>                                 Finds pointers to the GC heap within the given memory regions.
gchandles <arguments>                                    Provides statistics about GCHandles in the process.
gcheapstat, GCHeapStat                                   Displays various GC heap stats.
gcinfo <arguments>                                       Displays JIT GC encoding for a method.
gcroot, GCRoot <target>                                  Displays info about references (or roots) to an object at the specified address.
gctonative <memorytypes>                                 Finds GC objects which point to the given native memory ranges.
gcwhere, GCWhere <address>                               Displays the location in the GC heap of the specified address.
help, soshelp <command>                                  Displays help for a command.
histclear <arguments>                                    Releases any resources used by the family of Hist commands.
histinit <arguments>                                     Initializes the SOS structures from the stress log saved in the debuggee.
histobj <arguments>                                      Examines all stress log relocation records and displays the chain of garbage collection relocations that may have led to  the address passed in as an argument.
histobjfind <arguments>                                  Displays all the log entries that reference an object at the specified address.
histroot <arguments>                                     Displays information related to both promotions and relocations of the specified root.
histstats <arguments>                                    Displays stress log stats.
ip2md <arguments>                                        Displays the MethodDesc structure at the specified address in code that has been JIT-compiled.
listnearobj, lno, ListNearObj <address>                  Displays the object preceding and succeeding the specified address.
loadsymbols <url>                                        Loads symbols for all modules.
logclose <path>                                          Disables console file logging.
logging <path>                                           Enables/disables internal diagnostic logging.
logopen <path>                                           Enables console file logging.
maddress                                                 Displays a breakdown of the virtual address space.
modules, lm                                              Displays the native modules in the process.
name2ee <arguments>                                      Displays the MethodTable structure and EEClass structure for the specified type or method in the specified module.
notreachableinrange <start> <end>                        A helper command for !finalizerqueue
objsize, ObjSize <objectaddress>                         Lists the sizes of the all the objects found on managed threads.
parallelstacks, pstacks                                  Displays the merged threads stack similarly to the Visual Studio 'Parallel Stacks' panel.
pathto, PathTo <source> <target>                         Displays the GC path from <root> to <target>.
printexception, pe <arguments>                           Displays and formats fields of any object derived from the Exception class at the specified address.
registers, r                                             Displays the thread's registers.
runtimes <id>                                            Lists the runtimes in the target or changes the default runtime.
setclrpath <path>                                        Sets the path to load coreclr DAC/DBI files.
setsymbolserver, SetSymbolServer <url>                   Enables and sets symbol server support for symbols and module download.
sizestats                                                Size statistics for the GC heap.
sosflush                                                 Resets the internal cached state.
sosstatus                                                Displays internal status.
syncblk <arguments>                                      Displays the SyncBlock holder info.
taskstate, tks <address>                                 Displays a Task state in a human readable format.
threadpool, ThreadPool                                   Displays info about the runtime thread pool.
threadpoolqueue, tpq                                     Displays queued ThreadPool work items.
threads, setthread <thread>                              Lists the threads in the target or sets the current thread.
threadstate <arguments>                                  Pretty prints the meaning of a threads state.
timerinfo, ti                                            Displays information about running timers.
traverseheap, TraverseHeap <filename>                    Writes out heap information to a file in a format understood by the CLR Profiler.
verifyheap, VerifyHeap <memoryrange>                     Searches the managed heap for memory corruption..
verifyobj, VerifyObj <objectaddress>                     Checks the given object for signs of corruption.

help 帮助


0:000> !sos.help gctonative 
gctonative:
  Finds GC objects which point to the given native memory ranges.

Usage:
  >!sos gctonative [options] [<memorytypes>...]

Arguments:
  <memorytypes>    The types of memory to search the GC heap for.

Options:
  -a, --all    Show the complete list of objects and not just a summary.

-------------------------------------------------------------------------------
gctonative searches the GC heap for pointers to native memory.  This is used
to help locate regions of native memory that are referenced (or possibly held
alive) by objects on the GC heap.

usage: gctonative [--all] MADDRESS_TYPE_LIST

Note: The MADDRESS_TYPE_LIST must be a memory type as printed by maddress.

If --all is set, a full list of every pointer from the GC heap to the
specified memory will be displayed instead of just a summary table.

Sample Output:

    0:000> gctonative PAGE_READWRITE
    Walking GC heap to find pointers...
    Resolving object names...
    ================================================ PAGE_READWRITE Regions ================================================

    Well-known memory pointer summary:
    Type-----------------------------------------------------------------Count-----------Size---Size (bytes)-----RndPointer
    System.Reflection.Internal.ExternalMemoryBlockProvider          |    1,956 |     571.39mb |  599,145,088 | 7f0478747cf0
    System.Reflection.Internal.NativeHeapMemoryBlock+DisposableData |    1,956 |     571.39mb |  599,145,088 | 7f0478747cf0
    System.Reflection.Internal.ExternalMemoryBlock                  |    1,956 |     161.63mb |  169,483,352 | 7f04898e06a0
    System.Reflection.Metadata.MetadataReader                       |    1,956 |     161.63mb |  169,483,352 | 7f04898e06a0
    System.Reflection.RuntimeParameterInfo                          |      176 |     262.63kb |      268,928 | 7f058000c220
    -----------------------------------------------------------------------------------------------------------------------
    [TOTAL]                                                         |    1,963 |     571.40mb |  599,155,784

    Other memory pointer summary:
    Type----------------------------------------------------------------------------------Count-----RndPointer
    System.SByte[]                                                                   |    1,511 | 7f0500000000
    System.Byte[]                                                                    |      539 | 7f0500000000
    System.Reflection.RuntimeAssembly                                                |      135 | 7f05a0000ce0
    System.Char[]                                                                    |      121 | 7f0500000000
    System.Threading.UnmanagedThreadPoolWorkItem                                     |      113 | 7f05800120e0
    System.Diagnostics.Tracing.EventSource+EventMetadata[]                           |       75 | 7f0564001a20
    Microsoft.Win32.SafeHandles.SafeEvpMdCtxHandle                                   |       56 | 7f044013c170
    System.Threading.Thread                                                          |       40 | 7f05741d7bd0
    System.Security.Cryptography.SafeEvpPKeyHandle                                   |       40 | 7f051400cca0
    Microsoft.Win32.SafeHandles.SafeBioHandle                                        |       38 | 7f05400078d0
    Microsoft.Win32.SafeHandles.SafeX509Handle                                       |       37 | 7f04beab9c30
    Microsoft.Win32.SafeHandles.SafeSslHandle                                        |       20 | 7f0540007af0
    System.Text.RegularExpressions.RegexCache+Node                                   |       19 | 7f0500000001
    System.Collections.Concurrent.ConcurrentDictionary<...>+Node                     |       19 | 7f0500000001
    System.Diagnostics.Tracing.EventPipeEventProvider                                |       15 | 7f0580002240
    System.IntPtr[]                                                                  |       15 | 7f0578000d00
    Microsoft.Extensions.Logging.LoggerMessage+LogValues<...>                        |       12 | 7f0500000002
    Microsoft.Extensions.Logging.LoggerMessage+LogValues<...>+<...>d__9              |       12 | 7f0500000002
    Microsoft.Win32.SafeHandles.SafeX509StackHandle                                  |       10 | 7f0524179e50
    Microsoft.CodeAnalysis.CSharp.Symbols.MethodSymbol+<...>d__32                    |       10 | 7f0500000002
    Microsoft.CodeAnalysis.ModuleMetadata[]                                          |        5 | 7f052a7f7050
    System.Threading.TimerQueue+AppDomainTimerSafeHandle                             |        2 | 7f05a0006d30
    System.Net.Security.SafeFreeCertContext                                          |        2 | 7f04beab9c30
    System.Threading.LowLevelLock                                                    |        1 | 7f05a0003420
    Microsoft.CodeAnalysis.CSharp.CSharpCompilation+ReferenceManager+AssemblyData... |        1 | 7f05800120e0
    System.Net.Sockets.SocketAsyncEngine                                             |        1 | 7f059800edd0
    Microsoft.Extensions.Caching.Memory.CacheEntry                                   |        1 | 7f05241e0000
    System.Runtime.CompilerServices.AsyncTaskMethodBuilder<...>+AsyncStateMachine... |        1 | 7f0500000004

0:000> !sos.help maddress
maddress:
  Displays a breakdown of the virtual address space.

Usage:
  >!sos maddress [options]

Options:
  -stat, -summary      Only print summary table.
  -images              Prints a summary table of image memory usage.
  -reserve             Include MEM_RESERVE regions in the output.
  -reserveHeuristic    Heuristically tag MEM_RESERVE regions based on adjacent memory regions.
  -forceHandleTable    We only tag the HandleTable if we can do so efficiently on newer runtimes. This option ensures we always tag HandleTable memory, even if it will take a long time.
  -orderBySize         List the raw addresses by size, not by base address.
  -list <list>         A separated list of memory regions to list allocations for.

-------------------------------------------------------------------------------
!maddress is a managed version of !address, which attempts to annotate all memory
with information about CLR's heaps.

usage: !maddress [-summary] [-images] [-forceHandleTable] [-reserve [-reserveHeuristic]]

Flags:
    -summary
        Show only a summary table of memory regions and not the list of every memory region.

    -images
        Summarizes the memory ranges consumed by images in the process.

    -forceHandleTable
        Ensures that we will always tag HandleTable memory.
        On older versions of CLR, we did not have an efficient way to tag HandleTable
        memory.  As a result, we have to fully enumerate the HandleTable to find
        which regions of memory contain 
        
    -reserve
        Include reserved memory (MEM_RESERVE) in the output.  This is usually only
        useful if there is virtual address exhaustion.

    -reserveHeuristic
        If this flag is set, then maddress will attempt to "blame" reserve segments
        on the region that immediately proceeded it.  For example, if a "Heap"
        memory segment is immediately followed by a MEM_RESERVE region, we will call
        that reserve region HeapReserve.  Note that this is a heuristic and NOT
        intended to be completely accurate.  This can be useful to try to figure out
        what is creating large amount of MEM_RESERVE regions.

    -list
        A separated list of memory region types (as maddress defines them) to print the base
        addresses and sizes of.  This list may be separated by , or "in quotes".

    -orderBySize
        Order the list of memory blocks by size (descending) when printing the list
        of all memory blocks instead of by address.
posted @ 2024-08-23 09:59  一线码农  阅读(77)  评论(0编辑  收藏  举报