您的位置:首页 > 编程语言

使用SOS - 在Visual Studio中启用非托管代码调试来支持本机代码调试

2009-12-23 13:49 387 查看
【转】/article/4870535.html

SOS(Son of Strike)扩展调试器可以用来显示CLR数据结构的内容。SOS是作为.net framework的一部分安装的(SOS.dll),位于%windir%\Microsoft.NET\Framework\v*.*.****(版本号)\目录下。在使用SOS(加载SOS.dll)进行调试的步骤:
Step1 在Visual Studio中设置项目属性,以启动托管调试:Visual Studio打开要调试的项目,菜单->项目(Project)->Project属性->调试->启用非托管代码调试,如下图所示:
!help
-------------------------------------------------------------------------------
SOS is a debugger extension DLL designed to aid in the debugging of managed
programs. Functions are listed by category, then roughly in order of
importance. Shortcut names for popular functions are listed in parenthesis.
Type "!help <functionname>" for detailed info on that function.

Object Inspection Examining code and stacks
----------------------------- -----------------------------
DumpObj (do) Threads
DumpArray (da) CLRStack
DumpStackObjects (dso) IP2MD
DumpHeap U
DumpVC DumpStack
GCRoot EEStack
ObjSize GCInfo
FinalizeQueue EHInfo
PrintException (pe) COMState
TraverseHeap BPMD

Examining CLR data structures Diagnostic Utilities
----------------------------- -----------------------------
DumpDomain VerifyHeap
EEHeap DumpLog
Name2EE FindAppDomain
SyncBlk SaveModule
DumpMT GCHandles
DumpClass GCHandleLeaks
DumpMD VMMap
Token2EE VMStat
EEVersion ProcInfo
DumpModule StopOnException (soe)
ThreadPool MinidumpMode DumpAssembly
DumpMethodSig
DumpRuntimeTypes Other
DumpSig -----------------------------
RCWCleanupList FAQ
DumpIL

安装VS2003时,也会安装SOS的帮助文档,位于目录Program Files\Microsoft Visual Studio .NET 2003\SDK\v1.1\Tool Developers Guide\Samples\sos下;但VS2005中貌似没有安装该帮助文档,这里有更详细的文档http://msdn2.microsoft.com/en-us/library/ms954594.aspx...。我将这两份文档放在我的cnblogs上,可以从这里(http://files.cnblogs.com/happyhippy/sos.rar)下载。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐