Use SOS-enable unmanaged code debugging in Visual Studio to support local code debugging

Source: Internet
Author: User

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.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.