使用~查看所有線程
切換到一號線程:~1s
查看所有線程的托管堆棧 ~* e!clrstack
怎么查看,當前線程下,變量的信息?
對於托管代碼而言,最核心的命令就是!do(dump object的縮寫),后面是要加上變量的地址。
怎么知道當前線程的所有變量的地址?
先來看另外一個命令,!dso(Dump Stack Objects的縮寫)
!da 查看數組內容
OS命令(SOS Commands)
=======================
!threads |
view managed threads |
查看所有托管線程 |
!clrstack |
view the managed call stack |
查看托管調用棧 |
!dumpstack |
view combined unmanaged & managed call stack |
查看非托管和托管結合的調用棧 |
!clrstack -p |
view function call arguments |
查看托管函數調用的參數 |
!clrstack –l |
view stack (local) variables |
查看托管棧的局部變量 |
!name2ee module class |
view addresses associated with a class or method |
查看某個類或方法的內存地址 |
!dumpmt –mdaddress |
view the method table & methods for a class |
查看指定地址的方法表和一個類的方法集 |
!dumpmd address |
view detailed information about a method |
顯示指定地址的MethodDesc結構信息 |
!do address |
view information about an object |
顯示某地址的對象的信息, 包括fields, EEClass, Method Table和object size |
!dumpheap –stat |
view memory consumption by type |
顯示堆內存的使用 |
!dumpheap –min size |
view memory consumption by object when at least size |
查看堆內存使用, 忽略小於size字節大小的對象 |
!dumpheap –typetype |
view memory consumption for all objects of type type |
查看所有類型為type的對象的內存使用 |
!gcroot address |
view which object are holding a reference to address |
查看所有對指定地址的對象的引用 |
!syncblk |
view information about managed locks |
查看托管的鎖(SyncBlock結構) |
SOS 2.0 命令(SOS 2.0 Commands)
!bpmd module method |
set breakpoint |
在指定模塊的某一指定的方法上設置斷點 |
!DumpArray address |
view contents of an array |
查看數組中的元素 |
!PrintException |
view information about most recent exception |
格式化地顯示最近的異常信息 |