啟動, 附加進程, 執行和退出(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 –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 |
格式化地顯示最近的異常信息 |

