標籤:des style blog http io os ar 使用 for
啟動, 附加進程, 執行和退出(Starting, Attaching, Executing and Exiting)
=======================
|
Start -> All Programs -> Debugging Tools for Windows -> WinDBG |
啟動 |
F6 |
attach to process |
附加到進程 |
Ctrl-Break |
interrupt debugee |
中斷正在被debug的程式 |
.detach |
detach from a process |
脫離進程 |
g |
continue debugee execution |
繼續執行被debug的程式 |
q |
exit WinDBG |
退出WinDBG |
獲得協助(Getting Help)
=======================
? |
help on commands that affect the debugee |
列出所有的內建命令和操作符 |
.help |
help on commands that affect the debugger |
列出所有的元命令 |
.hh command |
view the on line help file |
開啟WinDBG的協助檔案 |
!help |
help on the extension dll at the top of the chain (e. g., SOS) |
列出擴充DLL中的擴充命令協助 |
操縱命令(Issuing Commands)
=======================
up arrow, down arrow, enter |
scroll through command history |
瀏覽命令曆史 |
Right mouse button |
paste into command window |
在命令視窗中粘貼 |
檢查非託管環境(Examining the Unmanaged Environment)
=======================
lmf |
list loaded modules with full path |
列出已載入了的模組及其完整路徑 |
lmt |
list loaded modules with last modified timestamp |
列出已載入了的模組和最後修改的時間戳記 |
~ |
list unmanaged threads |
列出所有非託管線程 |
~thread s |
select a thread for thread specific commands |
|
!token -n |
view thread permissions |
|
k |
view the unmanaged call stack |
查看非託管調用棧 |
!runaway |
view thread CPU consumption |
顯示每個線程佔用的時間 |
bp |
set a breakpoint |
設定一個斷點 |
.dump path |
dump small memory image |
建立一個小的dump記憶體鏡像 |
.dump /ma path |
dump complete memory image |
建立一個完整的dump檔案 |
使用Debuger DLL擴充(Working with Extension DLLs (e. g., SOS))
=======================
.chain |
list extensions dlls |
列出所有載入了的debugger extension |
.load clr10\sos |
load SOS for debugging framework 1.0 / 1.1 |
載入.net 1.1託管程式的debug擴充 |
.unload clr10\sos |
unload SOS |
卸載SOS |
.loadby sos mscorwks |
load SOS for debugging framework 2.0 |
載入.net 2.0的debug 擴充 |
SOS命令(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 –md address |
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 –type type |
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 |
格式化地顯示最近的異常資訊 |
資料來源:
WinDbg / SOS Cheat Sheet
http://geekswithblogs.net/.netonmymind/archive/2006/03/14/72262.aspx
SOS.dll (SOS Debugging Extension)
http://msdn.microsoft.com/en-us/library/bb190764.aspx
[轉]http://www.cnblogs.com/awpatp/archive/2010/05/30/1747736.html
WinDBG 常用命令表[轉]