CLR Debugging

1. CLR Process

  • Source code -> Compiler -> .NET Assembly -> CLR JIT
  • Application domains (System, Shared, Default)
  • Assemblies (Private, Shared) (logical constructs)
  • Modules (physical constructs)
  • Types (Fundamental unit of programmability) (Value types, Reference types)
  • Method Tables (Also known as a type handle, Contains information that describes the type)
  • Method Descriptors
    • Additional information that completes the descriptive nature of types
    • Type handle contains basic information about method on the type
    • Method descriptor augments that information (JIT status, Address of JIT’ed code)

Ref : http://msdn.microsoft.com/en-us/magazine/cc163791.aspx

2. Debugger Extensions

  • SOS (Son of Strike)
  • SOSEX (3rd party extension, http://www.stevestechspot.com/)
  • PSSCOR2/PSSCOR4

3. Debugger Command Categories

  • Object inspection
    • !DumpObject : Dumps a single reference object
    • !DumpArray: Dumps an array object
    • !GCRoot: Dumps the reference chain of an object
    • !mdv : Displays local variables
    • !strings: Dump out all the strings
    • !threads: shows the last exception thrown on any given thread
    • !PrintException : shows the exception information of the specified exception
  • Code and Threads
    • !U : Disassembles the code at the specific address
    • !IP2MD: Returns the method descriptor for the given code address
    • !threads : Displays all managed threads in the process
    • !ClrStack : Displays the managed call stack of the current thread
    • ~*e!ClrStack: Displays all managed threads and their callstack
  • Diagnostics
    • !VerifyHeap : Validates managed heap integrity
    • !GCHandles : Shows all handles in the process
    • !GCHandleLeaks: Attempts to find leaked handles
    • !VMStat: Virtual memory statistics
  • CLR data structures
    • !DumpDomain: Dumps out the application domains
    • !ThreadPool : Dumps out information on the CLR thread pool
    • !DumpIL : Dumps the IL for the specified address

 4. Managed Debug Assistants

  • Similar to Application Verifier
  • Enabled via the registry and config files (HKLM\Software\Microsoft\.NETFramework\MDA=“1”, <appname>.exe.dma.config)

SOS Cheat Sheet: http://blogs.msdn.com/b/alejacma/archive/2009/06/30/sos-cheat-sheet-net-2-0-3-0-3-5.aspx

转载于:https://www.cnblogs.com/Dennymei/archive/2013/01/30/2883204.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值