SOS.dll (SOS Debugging Extension)

  • lays threads associated with a live thread.

  • The -special option displays all special threads created by the CLR. Special threads include garbage collection threads (in concurrent and server garbage collection), debugger helper threads, finalizer threads, AppDomainunload threads, and thread pool timer threads.

ThreadState <State value field>

Displays the state of the thread. The value parameter is the value of the State field in the Threads report output.

Example:

 
 
0:003> !Threads
ThreadCount: 2
UnstartedThread: 0
BackgroundThread: 1
PendingThread: 0
DeadThread: 0
Hosted Runtime: no
PreEmptive GC Alloc Lock
ID OSID ThreadOBJ State GC Context Domain Count APT Exception
0 1 250 0019b068 a020 Disabled 02349668:02349fe8 0015def0 0 MTA
2 2 944 001a6020 b220 Enabled 00000000:00000000 0015def0 0 MTA (Finalizer)
0:003> !ThreadState b220
Legal to Join
Background
CLR Owns
CoInitialized
In Multi Threaded Apartment

TraverseHeap [-xml] <filename>

Writes heap information to the specified file in a format understood by the CLR profiler. The -xml option causes the TraverseHeap command to format the file as XML.

You can download the CLR Profiler from the Microsoft Download Center.

U [-gcinfo] [-ehinfo] [-n] <MethodDesc address> | <Code address>

Displays an annotated disassembly of a managed method specified either by a MethodDesc structure pointer for the method or by a code address within the method body. The U command displays the entire method from start to finish, with annotations that convert metadata tokens to names.

  • The -gcinfo option causes the U command to display the GCInfo structure for the method.

  • The -ehinfo option displays exception information for the method. You can also obtain this information with the EHInfo command.

  • The -n option disables the display of source file names and line numbers. If the debugger has the option SYMOPT_LOAD_LINES specified, SOS looks up the symbols for every managed frame and, if successful, displays the corresponding source file name and line number. You can specify the -n option to disable this behavior.

VerifyHeap

Checks the garbage collector heap for signs of corruption and displays any errors found.

Heap corruptions can be caused by platform invoke calls that are constructed incorrectly.

VerifyObj <object address>

Checks the object that is passed as an argument for signs of corruption.

VMMap

Traverses the virtual address space and displays the type of protection applied to each region.

VMStat

Provides a summary view of the virtual address space, ordered by each type of protection applied to that memory (free, reserved, committed, private, mapped, image). The TOTAL column displays the result of the AVERAGE column multiplied by the BLK COUNT column.

Remarks

 

The SOS Debugging Extension lets you view information about code that is running inside the common language runtime. For example, you can use the SOS Debugging Extension to display information about the managed heap, look for heap corruptions, display internal data types used by the runtime, and view information about all managed code running inside the runtime.

To use the SOS Debugging Extension in Visual Studio, install the Windows Driver Kit (WDK). For information about the integrated debugging environment in Visual Studio, see Debugging Environments in the Windows Dev Center.

You can also use the SOS Debugging Extension by loading it into the WinDbg.exe debugger, which is available from the WDK and Developer Tools Web site, and executing commands within WinDbg.exe.

To load the SOS Debugging Extension into the WinDbg.exe debugger, run the following command in the tool:

 
 
.loadby sos clr

WinDbg.exe and Visual Studio use a version of SOS.dll that corresponds to the version of Mscorwks.dll currently in use. In versions 1.1 and 2.0 of the .NET Framework, SOS.dll is installed in the same directory as Mscorwks.dll. By default, you should use the version of SOS.dll that matches the current version of Mscorwks.dll.

To use a dump file created on another computer, make sure that the Mscorwks.dll file that came with that installation is in your symbol path, and load the corresponding version of SOS.dll.

To load a specific version of SOS.dll, type the following command into the Windows Debugger:

 
 
.load <full path to sos.dll>

Examples

 

The following command displays the contents of an array at the address 00ad28d0. The display starts from the second element and continues for five elements.

 
 
!dumparray -start 2 -length 5 -detail 00ad28d0

The following command displays the contents of an assembly at the address 1ca248.

 
 
!dumpassembly 1ca248

The following command displays information about the garbage collector heap.

 
 
!dumpheap

The following command writes the contents of the in-memory stress log to a (default) file called StressLog.txt in the current directory.

 
 
!DumpLog

The following command displays the MethodDesc structure at the address 902f40.

 
 
!dumpmd 902f40

The following command displays information about a module at the address 1caa50.

 
 
!dumpmodule 1caa50

The following command displays information about an object at the address a79d40.

 
 
!DumpObj a79d40

The following command displays the fields of a value class at the address 00a79d9c using the method table at the address 0090320c.

 
 
!DumpVC 0090320c 00a79d9c

The following command displays the process memory used by the garbage collector.

 
 
!eeheap -gc

The following command displays all objects scheduled for finalization.

 
 
!finalizequeue

The following command determines the application domain of an object at the address 00a79d98.

 
 
!findappdomain 00a79d98

The following command displays all garbage collector handles in the current process.

 
 
!gcinfo 5b68dbb8

The following command displays the MethodTable and EEClass structures for the Main method in the class MainClass in the module unittest.exe.

 
 
!name2ee unittest.exe MainClass.Main

The following command displays information about the metadata token at the address 02000003 in the module unittest.exe.

 
 
!token2ee unittest.exe 02000003
 
https://developer.microsoft.com/zh-cn/windows/hardware/windows-driver-kit
http://sharptoolbox.com/tools/dottrace
http://sharptoolbox.com/tools/net-memory-profiler

SOS.dll (SOS Debugging Extension)的更多相关文章

  1. CLR调试时的sos.dll/clr.dll/mscorwks.dll/mscordacwks.dll等动态库的版本对应

    大家都知道,在调试托管代码时,一定会加载到sos/clr/mscorwks/mscordacwks这些动态库,才能够很好的完成我们的调试工作,那么他们的版本对应关系是怎样的呢,特别是clr.dll/m ...

  2. The version of SOS does not match the version of CLR you are debugging; SOS.dll版本不匹配; Dump文件不同环境mscordacwks.dll版本问题

    The version of SOS does not match the version of CLR you are debugging 和 PDB symbol for clr.dll not ...

  3. windbg自行下载的sos.dll存放路径“..\SOS_x86_x86_4.7.3132.00.dll\5B5543296ee000\”里的“5B5543296ee000”是什么?

    问题的引出 我在调试某个崩溃问题时,要跟踪clr的栈,于是,我先执行了指令.loadby sos clrjit,没有报错,然后我又执行!clrstack,结果却有如下输出:0:000:x86> ...

  4. SOS 调试扩展 (SOS.dll) 《第五篇》

    一.SOS扩展命令 SOS包含几十个命令,要熟练使用SOS,首先要了解SOS有哪些命令.下面给出SOS命令列表. 命令 描述 BPMD [<module name> <method ...

  5. SOS.DLL在windbg里加载错误

    sos.dll/mscordacwks.dll 公共语言运行库(CLR)是执行托管代码的Microsoft.NET框架的核心引擎.简单地说,它通过在托管程序集中使用中间语言和元数据,JIT按需编译代码 ...

  6. windbg加载sos.dll

    SOS.dll 中提供的 Son of Strike 扩展 (SOS),用于调试 WinDbg 中的托管代码.在启动了调试程序并将其附加到托管进程(或加载故障转储) .load C:\Windows\ ...

  7. SOS.dll(SOS 调试扩展)

      SecAnnotate.exe(.NET 安全批注器工具) SignTool.exe(签名工具) Sn.exe(强名称工具) SOS.dll(SOS 调试扩展)   SqlMetal.exe(代码 ...

  8. SOS 调试扩展 (SOS.dll)

    http://blog.csdn.net/cslie/article/details/2158780 SOS 调试扩展 (SOS.dll) 提供公共语言运行时(CLR)内部环境的有关信息,帮助你在Wi ...

  9. 【C# .Net GC】sos.dll 混合模式调试(托管调试+本机)

    当我们想使用本机调试器(如CDB或WinDBG)调试.NET应用程序时,我们必须在本机调试器和托管世界之间使用"桥",因为本机调试器本身并不理解托管代码.它是本机调试器.为了提供这 ...

随机推荐

  1. Objective-C

    1.OC基础 第一个OC的类 Objective-C: 字符串NSString与NSMutableString iOS开发的入门总结的第一篇 iOS开发的入门总结的第二篇

  2. HBase数据模型剖析

    出处:http://wuyudong.com/1987.html HBase 进行数据建模的方式和你熟悉的关系型数据库有些不同.关系型数据库围绕表.列和数据类型——数据的形态使用严格的规则.遵守这些严 ...

  3. android拍照选择图片上传服务器自定义控件

    做android项目的时候总免不了遇到图片上传功能,虽然就是调用android系统的拍照和相册选择功能,但是总面部了把一大推代码写在activity里,看上去一大推代码头都昏了.不如把这些功能都集成一 ...

  4. iOS 简单工厂模式

    iOS 简单工厂模式 什么是简单工厂模式? 简单工厂模式中定义一个抽象类,抽象类中声明公共的特征及属性,抽象子类继承自抽象类,去实现具体的操作.工厂类根据外界需求,在工厂类中创建对应的抽象子类实例并传 ...

  5. Swift 中的函数(下)

    学习来自<极客学院:Swift中的函数> 工具:Xcode6.4 直接上基础的示例代码,多敲多体会就会有收获:百看不如一敲,一敲就会 import Foundation /******** ...

  6. python基本数据结构-字典-方法

  7. redis AOF保存机制

    网上说AOF有三种保存方式,不自动保存.每秒自动保存.每命令自动保存. 其中每秒自动保存这个看起来很美好,但是可能会被各种IO的时间所延迟,所以究竟是怎么判断每秒保存的,并不是太明白,故有此文. AO ...

  8. poj 1144 Network 图的割顶判断模板

    Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8797   Accepted: 4116 Descripti ...

  9. xamarin.android 给View控件 添加数字提醒效果-BadgeView

    本文代码从java项目移植到.net项目   java开源项目:https://github.com/jgilfelt/android-viewbadger using System; using S ...

  10. hadoop debug script

    A Hadoop job may consist of many map tasks and reduce tasks. Therefore, debugging a Hadoop job is of ...