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. JAVA基础学习day23--GUI基础

    一.GUI概述 1.1.GUI概述 Graphical User Interface(图形用户接口) 用图形的方式,来显示计算机操作的界面, CLI: Command line User Interf ...

  2. iOS 简单工厂模式

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

  3. iOS 秒数转换成时间,时,分,秒

    //转换成时分秒 - (NSString *)timeFormatted:(int)totalSeconds{ int seconds = totalSeconds % 60;     int min ...

  4. JSP入门&会话技术

    一.JSP    1.jsp技术        jsp是sun提供动态web资源开发技术.为了解决在Servlet中拼写html内容css.js内容十分不方便的问题,sun提供了这样一门技术.如果说S ...

  5. tomcat下部署润乾报表

    因为项目需要,需要在项目中配置润乾报表,之前一直是用的jboss服务器,此处调整为tomcat时出错,然后各种找错,找答案,最后终于好了,然后总结一下. 首先在apache-tomcat-6.0.43 ...

  6. [QTP/UFT12]无限延长试用期的方法

    1. 删除C:\ProgramData隐藏目录下的SafeNet Sentinel文件夹 2.运行QTP安装目录下的bin\instdemo.exe 3. 重新运行QTP/UFT 12后即可恢复30天 ...

  7. 使用Spring整合Hibernate,并实现对数据表的增、删、改、查的功能

    1.1 问题 使用Spring整合Hibernate,并实现资费表的增.删.改.查. 1.2 方案 Spring整合Hibernate的步骤: 1.3 步骤 实现此案例需要按照如下步骤进行. 采用的环 ...

  8. Button未设type属性时在非IE6/7中具有submit特性

    代码如下 <!DOCTYPE html> <html> <head> <title>Button在Form中具有submit的特性</title& ...

  9. Linux系统搭建LAMP平台

    知识背景(来自:百度百科): LAMP指的Linux(操作系统).Apache HTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指Perl或Python) 的第一 ...

  10. VMware + OpenStack: 从 Plugin 到 VIO (VMware Integrated OpenStack)的演进

    VMware 做为实际上的企业虚拟化领导者,对 OpenStack 的态度一直在变化.一开始,VMware 表达出与 OpenStack 的竞争态度.随着 OpenStack 的逐步壮大并且一步一步进 ...