The SOS (Son of Strike) extended debugger can be used to display the content of the CLR data structure. SOS is used.. net framework (SOS. dll) at % windir % \ Microsoft. NET \ Framework \ v *. *. * *** (Version Number) \ directory. To use SOS (load SOS. dll) for debugging:
Step 1Set Project Properties in Visual Studio to start managed debugging: Visual Studio opens the Project to be debugged, menu-> Project) -> Project properties-> debug-> enable unmanaged code debugging, as shown in:
Step 2In the Code, set the breakpoint-> F5 to start debugging and run it at the breakpoint;
Step 3Set the Symbol directory:
If you do not set the Symbol directory, the following command will prompt "PDB symbol for mscorwks. dll not loaded ", here we just need to set the Symbol Directory: menu-> tool-> Option-> debugging-> Symbol, set as follows:
Step 4Menu-> Debug-> window (Windows)-> instant (Immediate), enter "! Load sos. dll to load SOS. dll. If the file is successfully loaded, the system prompts "extended % windir % \ Microsoft. NET \ Framework \ v *. *. * *** (Version) \ sos. dll ";
Step 5In the "instant window", enter "! Help "to obtain a list of Debugging commands (as shown below), enter "! Help <command> "to obtain detailed information about the command.
! 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
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
When installing VS2003, the SOS help document will also be installed in the directory Program Files \ Microsoft Visual Studio. NET 2003 \ SDK \ v1.1 \ Tool Developers Guide \ Samples \ sos; however, this help document does not appear to be installed in VS2005. For more details, see http://msdn2.microsoft.com/en-us/library/ms954594.aspx .... I put these two documents on my cnblogs, which can be downloaded from here (http://files.cnblogs.com/happyhippy/sos.rar.