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. Arcengine实现创建网络数据集札记(一)

    一 引子 网络数据集,GIS空间分析基础的理论和知识,是最短路径分析.连通性分析等其他空间分析技术的数据基础. 以往,网络数据集的研究很少,此次项目开发过程中,对网络数据集以及arcengine创建网 ...

  2. 【读书笔记】iOS-NSDictionary与NSArray的比较

    有时候为什么不用数组存储然后在数组里查询数值呢?字典(也称为散列表或关联数组)使用的是键查询的优化存储方式.它可以立即找出要查询的数据,而不需要遍历整个数组进行查找.对于频繁的查询和大型的数据集来说, ...

  3. 【读书笔记】iOS-头文件导入-@class注意事项

    一,导入头文件有两种不同的方法:使用引号或者使用尖括号,例如,#import <Cocoa/Cocoa.h>和#import "Tire.h".带尖括号的语句是用来导入 ...

  4. OC中几种集合的遍历方法(数组遍历,字典遍历,集合遍历)

    // 先分别初始化数组.字典和集合,然后分别用for循环.NSEnumerator枚举器和forin循环这三个方法来实现遍历 NSArray *array = @[@"yinhao" ...

  5. Unity与Android的相互交互

    1.Unity调用Android. Unity块代码: using (AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.play ...

  6. [android] 手机卫士界面切换动画

    在/res/anim/ 建立文件tran_out.xml 添加<translate>节点 设置x轴来源坐标android:fromXDelta=”0” 设置x轴目的坐标android:to ...

  7. android 隐藏标题栏

    在onCreate()方法中添加如下代码: public class FirstActivity extends Activity { @Override protected void onCreat ...

  8. iOS网络-01-NSURLRequest与NSURLConnection

    NSURLRequest NSURLRequest封装了一次网络请求所需要的数据,主要封装了以下信息: 请求路径(URL) 请求方法(GET或POST) 请求头 请求体 超时参数 NSURLReque ...

  9. 阿里云上安装vsftp笔记

    安装 ftp 1 ssh登录服务器       首先检查有没有安装运行 ps -ef |grep vsftpd         2 yum安装vsftpd        yum安装    yum in ...

  10. 函数return/获取元素样式/封装自己的库

    一:函数return <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type&qu ...