ZZ from:http://www.cppblog.com/Walker/archive/2012/06/28/146523.html
不要再假裝自己寫的程序沒bug了,不可能的,debug工具你早晚得用上。最常見的debug工具非printf(windows上用OutputDebugString函數)莫屬,簡單方便易學易用,但侷限性也是顯而易見的,首先它對debugee的影響很大,某些race condition的bug你要多加幾個log它就重現不出來了,然後你把log去了發佈給客戶,結果又成了必現的bug,這種爛事咱們都碰到過,你懂的。其次log能打印的東西有限,有時候你加log追某個變量的值,追到最後發現是其他變量有問題,這時候你又得加log重新跑。最後分析log的過程及其枯燥無聊,而在debug上敲命令分析則充滿了樂趣。我知道有些人對debugger持有鄙視的態度,“單步調試是程序員的恥辱”云云。其實我想說的是,有好工具在手上幹嘛不用,又不會懷孕,怕什麼。
我們今天要來聊聊windbg,windows上debug的神器,(個人感覺)gdb也不如它。不是說windbg本身寫的多麼多麼好,它牛逼的地方在於它是可擴展的,windows上的內核開發人員驅動開發人員用了windbg這麼多年,該碰到的問題都碰到過了,該提的需求都提了,該寫的擴展也都寫了,導致現在的windbg強大無比,基本啥問題都能解決。就算你的需求很奇葩別人沒想過,你也可以用windbg提供的開發框架自己寫一個擴展,不費什麼時間。所以我們看,提供擴展功能的工具都會變成神器,瀏覽器如此,debug工具也是一樣。廢話不多說,讓我們來看幾個非常有用的擴展:
!Drvobj
這個命令接收一個driver的名字作爲參數,解析名字並找到對應的driver object,然後把由這個驅動程序產生的device object打印出來,如下:
lkd> !drvobj \Driver\usbhub
Driver object (8999a4f8) is for:
\Driver\usbhub
Driver Extension List: (id , addr)
Device Object list:
89701de8 89a3f330 8974ede8 8977cc98
8985ac98 89862c98 898b4c98 89add030
89876c98 89849aa8
我們看到,usbhub驅動程序對應的driver object是8999a4f8,由它生成了10個device object。
!Devobj
這個命令接收device object指針作爲參數,並打印出該device object的內容,包括當前處理的irp,refrence count,device extension,以及與這個device object相關的上層驅動和下層驅動等,如下
lkd> !devobj 89701de8
Device object (89701de8) is for:
USBPDO-9 \Driver\usbhub DriverObject 8999a4f8
Current Irp 00000000 RefCount 0 Type 00000022 Flags 00003040
Dacl e16dcf84 DevExt 89701ea0 DevObjExt 89701fd0 DevNode 89998df0
ExtensionFlags (0000000000)
AttachedDevice (Upper) 89712b20 \Driver\HidUsb
Device queue is not busy.
lkd> !devobj 89a3f330
Device object (89a3f330) is for:
USBPDO-8 \Driver\usbhub DriverObject 8999a4f8
Current Irp 00000000 RefCount 0 Type 00000022 Flags 00003040
Dacl e16dcf84 DevExt 89a3f3e8 DevObjExt 89a3f518 DevNode 899b23c8
ExtensionFlags (0000000000)
AttachedDevice (Upper) 8971cb90 \Driver\TcUsb
Device queue is not busy.
我們查看了usbhub產生的10個device中的前兩個,可以看出其中有一個是hidusb,另一個是tcusb。順着AttachedDevice打印出的內容我們可以手動遍歷整個驅動棧,不過這看起來有些麻煩,萬幸有人以經寫好一個擴展可以幫我們遍歷了,那就是
!devstack
該命令也接收device object作爲參數,並遍歷着把該object以下的驅動棧全部打印出來,直到bus driver爲止,如下
lkd> !devstack 89a3f330
!DevObj !DrvObj !DevExt ObjectName
8971cb90 \Driver\TcUsb 8971cc48 000000ae
> 89a3f330 \Driver\usbhub 89a3f3e8 USBPDO-8
!DevNode 899b23c8 :
DeviceInst is "USB\Vid_0483&Pid_2016\5&39a18bdd&0&2"
ServiceName is "TcUsb"
可以看到tc usb在usbhub之上,而usbhub則是硬件"USB\Vid_0483&Pid_2016\5&39a18bdd&0&2“的bus driver。前面有篇博文我們說到過windows裏把幾乎所有的資源都抽象成了一個"object”的概念,所有的object都有一個結構一致的object head,以方便提供統一的操作接口,以下命令就是打印出obect信息的命令:
!object
kd> !object \
Object: e1001300 Type: (8a65e2c0) Directory
ObjectHeader: e10012e8 (old version)
HandleCount: 0 PointerCount: 39
Directory Object: 00000000 Name: \
292 symbolic links snapped through this directory
Hash Address Type Name
---- ------- ---- ----
00 e100b6e0 Directory ArcName
8a515030 Device Ntfs
01 e2726b88 Port SeLsaCommandPort
03 e1011488 Key \REGISTRY
05 e2728888 Port ThemeApiPort
06 e16c7f68 Port XactSrvLpcPort
09 e1d4d428 Directory NLS
10 e1001078 SymbolicLink DosDevices
13 e1c9e160 Port SeRmCommandPort
14 8a577030 Device Dfs…
我們查看了根目錄,並列出了它的所有子項(太多了,沒全貼上來),它的功能跟winobj很像,不過沒有winobj直觀。再來看幾個跟power有關的命令。我們知道用wdm寫驅動最麻煩的事情之一就是所有的power命令都要自己handle,而wdf則幫我們全包圓了(又回到上會的討論了不是),沒包圓也有它的好處,就是你得強迫自己去理解這部分內容。power irp處理不好,機器很容易就不能進s3/s4或者不能從s3/s4喚醒,這時候我們就得藉助windbg來追查問題到底出在哪兒,查看當前power狀態的命令是
!podev
該命令接收device object爲參數,打印它當前的power狀態
lkd> !podev 89784b10
Device object is for:
DriverObject 899d4410
Current Irp 00000000 RefCount 0 Type 00000002 DevFlags 00000050
Device queue is not busy.
Device Object Extension: 89784bc8:
PowerFlags: 00000000 =>SystemState=0 DeviceState=0
Dope: 00000000:
我們看到目前device處於d0(working)狀態,系統處於s0(idle)狀態。但是這個命令只能給我們一個總結,到底哪些power irp正在處理我們沒法看出來。以下命令正是列出系統中所有power irp的
!poreqlist
lkd> !poreqlist
All active Power Irps from PoRequestPowerIrp
PopReqestedPowerIrpList
FieldOffset = 00000004
Irp 8a60ba20 DevObj 8a5c1d70 \Driver\ACPI Ctx 00000004 Wait Wake S3
Irp 882f1e00 DevObj 89a05440 \Driver\usbuhci Ctx 00000001 Wait Wake S0
Irp 883dee00 DevObj 89a2b218 \Driver\usbuhci Ctx 00000001 Wait Wake S0
Irp 8843c008 DevObj 89a20528 \Driver\usbuhci Ctx 00000001 Wait Wake S0
Irp 884ca220 DevObj 89a10030 \Driver\usbehci Ctx 00000001 Wait Wake S0
Irp 883662d0 DevObj 89b36030 \Driver\usbehci Ctx 00000001 Wait Wake S0
Irp 87ec2008 DevObj 8974ede8 \Driver\usbhub Ctx 00000001 Wait Wake S0
Irp 89b4ec00 DevObj 899b7618 \Driver\usbuhci Ctx 00000001 Wait Wake S0
Irp 882ca7d0 DevObj 89a3f330 \Driver\usbhub Ctx 00000001 Wait Wake S0
我們看到很多的hid設備處於等待喚醒的狀態。
最後我們來聊聊內核調試時如何調試用戶態的東西。我們知道在進程的用戶態部分相互隔離,而內核部分都是share同一個地址空間,由這特性帶來的好處壞處我們先不談,今天先關注具體問題。斷在kernel裏的debugger要調試別的進程的kernel部分很容易,因爲地址是同一塊,但是要調試user mode部分就不那麼容易了。我們知道user mode是不可能直接訪問內核地址的,cpu在將虛地址翻譯成物理地址的時候會檢查特權級,user mode是第3級而內核是第0級,倘若第三級的指令帶的地址是第0級,cpu會拋拒絕訪問的異常。反過來,內核指令訪問user mode地址雖然可行,不過得考慮進程上下文,如果你不管進程上下文直接訪問user mode地址,有兩種錯誤情況會發生:你訪問的根本不是你想要的進程,或者你訪問的地址根本沒有東西。地址空間分爲用戶態和內核態這種說法是站在用戶態角度講的,它假設所有的線程都有"用戶態"部分,實際上PsCreateSystemThread產生的內核線程是沒有用戶態部分的,它附在一個叫"System”的進程上,而"System”進程只是爲管理方便而存在的虛擬的東西,沒有實體。所以我們說從內核debugger調試用戶態內容遠沒有kernel調kernel,user調user那麼簡單,你必須關心進程上下文這個東西。下面這個命令可以列出系統中所有的進程:
!process
lkd> !process -1 0
PROCESS 8854b020 SessionId: 0 Cid: 1060 Peb: 7ffd4000 ParentCid: 04b4
DirBase: 0abc0ae0 ObjectTable: e12e5650 HandleCount: 396.
Image: windbg.exe
lkd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS 881de6f8 SessionId: 0 Cid: 1498 Peb: 7ffde000 ParentCid: 04b4
DirBase: 0abc0c20 ObjectTable: e465aa70 HandleCount: 46.
Image: notepad.exe
如上所示,當前進程是windbg,process object爲8854b020,而我們關心notepad進程的process object是881de6f8 ,並不是同一個,我們首先要做的事情就是切換到notepad這個進程上去,使用內置命令.process
lkd> .process 881de6f8
Implicit process is now 881de6f8
然後f5讓系統跑一會兒(windbg斷住的時候,整個系統是掛起的,進程切換也不會發生),再次斷下來的時候你就已經在notepad進程裏了(上面列的打印都是在local kernel debug裏的,功能很受限,比如系統沒掛起,f5也不能用。接下來我要切換到雙機調試模式)
kd> !process -1 0
PROCESS 863c22f0 SessionId: 0 Cid: 00bc Peb: 7ffdb000 ParentCid: 05fc
DirBase: 06c602c0 ObjectTable: e16718e8 HandleCount: 29.
Image: notepad.exe
雖然已經在notepad進程裏了,但user mode的東西依然不可見,因爲windbg會緩存用戶態的信息,進程切換後,你得手工刷新緩存,用內置命令.reload /user。做完這一步後,user mode的信息就變得可見了,你可以在用戶態函數裏下斷點:kd> bp /p @$proc ntdll!ntcreatefile,或者列出加載模塊:lm 等等,就跟普通的用戶態程序調試一摸一樣。上面那一套步驟很煩,卻是步步都不能省,有沒有方法簡化它呢?如開頭所說,windbg是可擴展的,你想到的需求,別人早就想到,並且已經寫好工具等你用了,以下命令做完一整套動作:
!bpid
該命令接收process cid作爲參數,找到對應的進程並切換進程上下文,跑一會兒,斷下來,刷新用戶態內容,全部搞定。怎麼樣,是不是很方便?
!processfields
!processfields 擴展命令顯示執行進程塊(EPROCESS)中字段的名字和偏移。
語法
!processfields
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
不可用(查看註釋) |
註釋
該擴展命令在Windows XP和之後的系統中都不可用。可以直接使用 dt (Display Type) 命令顯示EPROCESS結構:
kd> dt nt!_EPROCESS
下面是!processfields 在Windows 2000系統中的示例:
kd> !processfields
EPROCESS structure offsets:
Pcb: 0x0
ExitStatus: 0x6c
LockEvent: 0x70
LockCount: 0x80
CreateTime: 0x88
ExitTime: 0x90
LockOwner: 0x98
UniqueProcessId: 0x9c
ActiveProcessLinks: 0xa0
QuotaPeakPoolUsage[0]: 0xa8
QuotaPoolUsage[0]: 0xb0
PagefileUsage: 0xb8
CommitCharge: 0xbc
PeakPagefileUsage: 0xc0
PeakVirtualSize: 0xc4
VirtualSize: 0xc8
Vm: 0xd0
DebugPort: 0x120
ExceptionPort: 0x124
ObjectTable: 0x128
Token: 0x12c
WorkingSetLock: 0x130
WorkingSetPage: 0x150
ProcessOutswapEnabled: 0x154
ProcessOutswapped: 0x155
AddressSpaceInitialized: 0x156
AddressSpaceDeleted: 0x157
AddressCreationLock: 0x158
ForkInProgress: 0x17c
VmOperation: 0x180
VmOperationEvent: 0x184
PageDirectoryPte: 0x1f0
LastFaultCount: 0x18c
VadRoot: 0x194
VadHint: 0x198
CloneRoot: 0x19c
NumberOfPrivatePages: 0x1a0
NumberOfLockedPages: 0x1a4
ForkWasSuccessful: 0x182
ExitProcessCalled: 0x1aa
CreateProcessReported: 0x1ab
SectionHandle: 0x1ac
Peb: 0x1b0
SectionBaseAddress: 0x1b4
QuotaBlock: 0x1b8
LastThreadExitStatus: 0x1bc
WorkingSetWatch: 0x1c0
InheritedFromUniqueProcessId: 0x1c8
GrantedAccess: 0x1cc
DefaultHardErrorProcessing 0x1d0
LdtInformation: 0x1d4
VadFreeHint: 0x1d8
VdmObjects: 0x1dc
DeviceMap: 0x1e0
ImageFileName[0]: 0x1fc
VmTrimFaultValue: 0x20c
Win32Process: 0x214
Win32WindowStation: 0x1c4
附加信息
關於EPROCESS塊的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!psp
!psp 擴展用於顯示指定地址處的處理器狀態參數寄存器(processor state parameter (PSP) register)。
該命令僅在Itanium目標機上支持。
語法
!psp Address [DisplayLevel]
參數
Address
指定要顯示的PSP寄存器的16進制地址。
DisplayLevel
可以是下面這些選項中任意一個:
0
僅顯示PSP字段的值。這是默認情況。
1
顯示非保留和非忽略的PSP字段的詳細信息。
2
顯示所有PSP字段的詳細信息,包括被忽略或保留的那些。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
!pte
!pte 擴展顯示指定地址的頁表項(page table entry (PTE))和頁目錄項(page directory entry (PDE))。
語法
Windows NT 4.0 和Windows 2000的語法
!pte VirtualAddress
!pte PTE
!pte LiteralAddress 1
!pte StartAddress EndAddress
Windows XP和之後的語法
!pte VirtualAddress
!pte PTE
!pte LiteralAddress 1
參數
VirtualAddress
指定需要查看頁表的虛擬地址。
PTE
指定實際的PTE的地址。
LiteralAddress 1
指定實際的PTE或PDE的地址。
StartAddress
(僅x86 或x64 目標機;僅 Windows NT 4.0 和Windows 2000) 指定某個範圍的開始的虛擬地址。該範圍內的所有頁表都會被顯示出來。
EndAddress
(僅x86 或x64 目標機; 僅Windows NT 4.0 和Windows 2000) 指定某個範圍的結束的虛擬地址。該範圍內的所有頁表都會被顯示出來。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
如果指定了一個參數,並且該參數是一個用於保存頁表的內存區域中的地址,那麼調試器將它當作一個PTE參數。該參數被當作要查看的PTE的實際地址,調試器會顯示該PTE以及相應的PDE。
如果指定的參數不在這個範圍內,調試器把它當作VirtualAddress。會顯示用於映射這個地址的PTE和PDE。
如果指定了兩個參數,並且第二個參數是1 (或者更小的數字),調試器將第一個參數當作LiteralAddress。這個地址會被當作PTE或者PDE的實際地址,並且顯示相應的數據(可能是錯誤的)。
(僅x86 或x64目標機) 如果提供了兩個參數,並且第二個參數比第一個大,調試器將它們當作StartAddress 和EndAddress。命令會顯示指定的內存範圍中每個頁面的PTE。
使用!sysptes擴展命令查看所有系統PTE的列表。
下面是x86目標機上的示例:
kd> !pte 801544f4
801544F4 - PDE at C0300800 PTE at C0200550
contains 0003B163 contains 00154121
pfn 3b G-DA--KWV pfn 154 G--A--KRV
輸出的第一行會再次顯示被查看的虛擬地址。然後是包含該地址內存映射(virtual-physical mapping)信息的PDE和PTE的虛擬地址。
第二行是PDE和PTE的實際內容。
第三行是對這些內容的分析,將它們分解成頁面幀序號(PFN)和狀態位(status bits)。
查看 !pfn擴展命令或者 將虛擬地址轉換成物理地址小節來獲得如何理解和使用PFN的信息。
在x86和x64目標機上,PDE和PTE的狀態位在下表中列出。!pte 的顯示會用大寫字母或者虛線來表示這些位,並且還添加其他信息。
位 |
設置時的顯示 |
清除時的顯示 |
意義 |
0x200 |
C |
- |
寫時複製(Copy on write) |
0x100 |
G |
- |
全局頁面(Global) |
0x80 |
L |
- |
大頁面(Large page)。只有PDE有,PTE中沒有。 |
0x40 |
D |
- |
髒頁面(Dirty) |
0x20 |
A |
- |
已訪問(Accessed) |
0x10 |
N |
- |
禁止緩存(Cache disabled) |
0x8 |
T |
- |
通寫(Write-through) |
0x4 |
U |
K |
所有者(用戶模式或內核模式)。 |
0x2 |
W |
R |
可寫或者只讀。只有在多處理器計算機和任何運行Windows Vista和之後系統的機器上有。 |
0x1 |
V |
有效位(Valid) |
|
E |
- |
可執行頁面。對於包括很多x86系統在內的不支持硬件執行/非執行標誌位的平臺,總是顯示E。 |
在Itanium目標機上,PDE和PTE的狀態位和PPE中有少許不同。Itanium PPE位有下面這些:
設置時的顯示 |
清除時的顯示 |
意義 |
V |
有效位(Valid) |
|
U |
K |
所有者(用戶模式或內核模式)。 |
D |
- |
髒頁面(Dirty) |
A |
- |
已訪問(Accessed) |
W |
R |
可寫或者只讀。只有在多處理器計算機和任何運行Windows Vista和之後系統的機器上有。 |
E |
- |
執行(Execute) |
C |
- |
寫時複製(Copy on write) |
附加信息
關於頁表、頁目錄和這些狀態位的說明,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!pte2va
!pte2va 擴展命令顯示指定的頁表項(PTE)對應的虛擬地址。
語法
!pte2va Address
Address
指定PTE。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
要查看指定的PTE的內容,使用!pte命令。
下面是!pte2va 擴展的輸出示例:
kd> !pte2va 9230
000800000248c000
附加信息
關於頁表和PTE的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!ptov
!ptov擴展顯示給定進程的整個物理地址到虛擬地址的映射(physical-to-virtual map)。
語法
!ptov PFN
參數
PFN
指定進程的頁目錄基址(directory base)的頁面幀序號(PFN)。這和去掉最後三個16進制數字的頁目錄基地址相同 (即右移12位)。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是一個示例。首先使用!process擴展來獲得需要的進程的頁目錄基址:
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
....
PROCESS ff779190 SessionId: 0 Cid: 04fc Peb: 7ffdf000 ParentCid: 0394
DirBase: 098fd000 ObjectTable: e1646b30 TableSize: 8.
Image: MyApp.exe
這裏的頁目錄基址是0x098FD000。去掉末尾的三個0,結果爲0x098FD。這就是頁目錄基址的頁面幀序號(PFN)。
將這個數字傳遞給!ptov:
kd> !ptov 98fd
7119000 10000
a21a000 20000
6133000 12e000
9de9000 12f000
2b0c000 130000
87cd000 131000
aaf6000 140000
... ...
左邊一列的數字是映射到該進程的每個內存頁面的物理地址。右邊一列是它們映射到的虛擬地址。
全部的輸出會非常長。
附加信息
相關主題,查看!vtop、 !vpdd、以及 將虛擬地址轉換成物理地址。關於頁表和頁目錄的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
WinDbg 文檔翻譯----84
cc682/NetRoc
http://netroc682.spaces.live.com/
!poolfind
!poolfind 擴展命令在非分頁和分頁內存中查找指定的pool tag。
語法
Windows NT 4.0中的語法
!poolfind TagString [PoolType]
Windows 2000和之後
!poolfind TagString [PoolType]
!poolfind TagValue [PoolType]
參數
TagString
指定pool tag。TagString 是區分大小寫的ASCII字符串。星號(*)可以用來表示任意數量的字符,問號 (?)可以用來代表一個字符。如果沒有使用星號, TagString 必須剛好是4個字符長度。
TagValue
(Windows 2000和之後) 指定pool tag。TagValue 必須以"0x"開頭,即使默認的基數爲16。如果該參數以任何其他值開頭(包括"0X"),則會被解釋爲ASCII的標籤字符串。
PoolType
指定要搜索的池類型。允許下面這些值:
0
指定非分頁內存池。這是默認值。
1
指定分頁內存池。
2
指定特殊池(special pool)。
4
(Windows XP和之後) 指定會話池(session pool)。
4, 5, 6
(僅Windows NT 4.0) 和0、1、2一樣,但是顯示詳細信息。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
該命令根據需要搜索的池內存大小的不同,需要很長時間來執行。要加快速度,可以通過CTRL+A (Toggle Baud Rate) 鍵增加COM端口,或者使用.cache (Set Cache Size) 命令增加緩存大小 (設置到大約10 MB)。
Pool tag和傳遞給ExAllocateXxx 類例程的標籤一樣。
下面是一個示例。搜索整個非分頁內存池之後搜索分頁池,但是命令在完成之前被終止(長時間操作之後):
kd> !poolfind SeSd 0
Scanning large pool allocation table for Tag: SeSd (827d1000 : 827e9000)
Searching NonPaged pool (823b1000 : 82800000) for Tag: SeSd
826fa130 size: c0 previous size: 40 (Allocated) SeSd
82712000 size: c0 previous size: 0 (Allocated) SeSd
82715940 size: a0 previous size: 60 (Allocated) SeSd
8271da30 size: c0 previous size: 10 (Allocated) SeSd
82721c00 size: 10 previous size: 30 (Free) SeSd
8272b3f0 size: 60 previous size: 30 (Allocated) SeSd
8272d770 size: 60 previous size: 40 (Allocated) SeSd
8272d7d0 size: a0 previous size: 60 (Allocated) SeSd
8272d960 size: a0 previous size: 70 (Allocated) SeSd
82736f30 size: a0 previous size: 10 (Allocated) SeSd
82763840 size: a0 previous size: 10 (Allocated) SeSd
8278b730 size: 100 previous size: 290 (Allocated) SeSd
8278b830 size: 10 previous size: 100 (Free) SeSd
82790130 size: a0 previous size: 20 (Allocated) SeSd
82799180 size: a0 previous size: 10 (Allocated) SeSd
827c00e0 size: a0 previous size: 30 (Allocated) SeSd
827c8320 size: a0 previous size: 60 (Allocated) SeSd
827ca180 size: a0 previous size: 50 (Allocated) SeSd
827ec140 size: a0 previous size: 10 (Allocated) SeSd
Searching NonPaged pool (fe7c3000 : ffbe0000) for Tag: SeSd
kd> !poolfind SeSd 1
Scanning large pool allocation table for Tag: SeSd (827d1000 : 827e9000)
Searching Paged pool (e1000000 : e4400000) for Tag: SeSd
e10000b0 size: d0 previous size: 20 (Allocated) SeSd
e1000260 size: d0 previous size: 60 (Allocated) SeSd
......
e1221dc0 size: a0 previous size: 60 (Allocated) SeSd
e1224250 size: a0 previous size: 30 (Allocated) SeSd
...terminating - searched pool to e1224000
kd>
附加信息
關於內存池和pool tag的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!poolused
!poolused 擴展用於根據每個內存池分配的標籤(tag)的使用來顯示內存使用摘要。
語法
Windows NT 4.0的語法:
!poolused [Flags]
Windows 2000和之後的語法:
!poolused [Flags [TagString]]
參數
Flags
指定要顯示的內容和輸出排序的方式。可以是下面這些位值的任意組合,但是bit 1 (0x2) 和 2 (0x4)不能一起使用。默認值爲0,僅輸出摘要信息,以pool tag排序。
Bit 0 (0x1)
顯示詳細信息。
Bit 1 (0x2)
以非分頁內存使用的總數來排序。
Bit 2 (0x4)
以使用分頁內存的總數來排序。
Bit 3 (0x8)
(Windows Server 2003和之後) 顯示session pool而不是standard pool。
TagString
(Windows 2000和之後) 指定pool tag。TagString是區分大小寫的ASCII字符串。星號 (*) 可用來代表任意數量的字符,問號 (?) 可以用來代表一個字符。如果沒有使用星號,TagString 必須剛好是4個字符的長度。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
!poolused 擴展利用Windows的內存池標籤(Pool tagging)功能來蒐集數據。Pool tagging在Windows Server 2003和之後版本的Windows中一直是起用的。在Windows XP和之前版本中必須使用Gflags來啓用。
如果在該擴展命令執行完成前停止它,調試器中會顯示出部分結果。
該命令會顯示每種標籤的paged pool和nonpaged pool內存使用。兩種情況下,顯示中都包含當前使用給定tag分配的次數,以及分配的這些存儲單元使用的字節數量。
下面是命令輸出的一部分的示例:
0: kd> !poolused
Sorting by Tag
Pool Used:
NonPaged Paged
Tag Allocs Used Allocs Used
1394 1 520 0 0UNKNOWN pooltag '1394', please update pooltag.txt
1MEM 1 3368 0 0UNKNOWN pooltag '1MEM', please update pooltag.txt
2MEM 1 3944 0 0UNKNOWN pooltag '2MEM', please update pooltag.txt
3MEM 3 248 0 0UNKNOWN pooltag '3MEM', please update pooltag.txt
8042 4 3944 0 0PS/2 kb and mouse , Binary: i8042prt.sys
AGP 1 344 2 384UNKNOWN pooltag 'AGP ', please update pooltag.txt
AcdN 2 1072 0 0TDI AcdObjectInfoG
AcpA 3 192 1 504ACPI Pooltags , Binary: acpi.sys
AcpB 0 0 4 576ACPI Pooltags , Binary: acpi.sys
AcpD 40 13280 0 0ACPI Pooltags , Binary: acpi.sys
AcpF 6 240 0 0ACPI Pooltags , Binary: acpi.sys
AcpM 0 0 1 128ACPI Pooltags , Binary: acpi.sys
AcpO 4 208 0 0ACPI Pooltags , Binary: acpi.sys
...
WmiG 30 6960 0 0Allocation of WMIGUID
WmiR 63 4032 0 0Wmi Registration info blocks
Wmip 146 3504 182 18600Wmi General purpose allocation
Wmit 1 4096 7 49480Wmi Trace
Wrpa 2 720 0 0WAN_ADAPTER_TAG
Wrpc 1 72 0 0WAN_CONN_TAG
Wrpi 1 120 0 0WAN_INTERFACE_TAG
Wrps 2 128 0 0WAN_STRING_TAG
aEoP 1 672 0 0UNKNOWN pooltag 'aEoP', please update pooltag.txt
fEoP 1 16 0 0UNKNOWN pooltag 'fEoP', please update pooltag.txt
hSVD 0 0 1 40Shared Heap Tag , Binary: mrxdav.sys
hibr 0 0 1 24576UNKNOWN pooltag 'hibr', please update pooltag.txt
iEoP 1 24 0 0UNKNOWN pooltag 'iEoP', please update pooltag.txt
idle 2 208 0 0Power Manager idle handler
jEoP 1 24 0 0UNKNOWN pooltag 'jEoP', please update pooltag.txt
mEoP 1 88 0 0UNKNOWN pooltag 'mEoP', please update pooltag.txt
ohci 1 136 0 01394 OHCI host controller driver
rx.. 3 1248 0 0UNKNOWN pooltag ' rx', please update pooltag.txt
sidg 2 48 0 0GDI spooler events
thdd 0 0 1 20480DirectDraw/3D handle manager table
usbp 18 77056 2 96UNKNOWN pooltag 'usbp', please update pooltag.txt
vPrt 0 0 18 68160UNKNOWN pooltag 'vPrt', please update pooltag.txt
TOTAL 3570214 209120008 38769 13066104
附加信息
關於內存池和內存池標籤的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!poolval
!poolval 擴展命令分析pool page 的頭部並診斷任何可能的錯誤。該命令僅在Windows XP和之後版本中可用。
語法
!poolval Address [DisplayLevel]
參數
Address
指定要分析頭部的pool的地址。
DisplayLevel
指定輸出中要包含的信息。可以是任意的下面這些值(默認爲0):
0
顯示基本信息。
1
顯示基本信息和頭部鏈表(linked header lists)。
2
顯示基本信息、頭部鏈表和基本的頭信息。
3
顯示基本信息、頭部鏈表,以及完整的頭信息。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
附加信息
關於內存池的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!popolicy
!popolicy 擴展顯示目標機的電源策略。
語法
!popolicy [Address]
參數
Address
指定要顯示的電源策略結構的地址。如果省略,則顯示nt!PopPolicy。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是命令輸出的示例:
kd> !popolicy
SYSTEM_POWER_POLICY (R.1) @ 0x80164d58
PowerButton: Shutdown Flags: 00000003 Event: 00000000 Query UI
SleepButton: None Flags: 00000003 Event: 00000000 Query UI
LidClose: None Flags: 00000001 Event: 00000000 Query
Idle: None Flags: 00000001 Event: 00000000 Query
OverThrottled: None Flags: c0000004 Event: 00000000 Override NoWakes Critical
IdleTimeout: 0 IdleSensitivity: 50%
MinSleep: S0 MaxSleep: S0
LidOpenWake: S0 FastSleep: S0
WinLogonFlags: 1 S4Timeout: 0
VideoTimeout: 0 VideoDim: 209
SpinTimeout: 0 OptForPower: 1
FanTolerance: 0% ForcedThrottle: 0%
MinThrottle: 0%
附加信息
使用!pocaps 擴展命令查看系統的電源能力(power cababilities)。關於電源能力和電源策略(power policy)的信息,查看Windows Driver Kit (WDK)文檔,以及Mark Russinovich and David Solomon 編寫的Microsoft Windows Internals。
!prcb
!prcb 擴展命令顯示處理器控制塊(processor control block (PRCB))。
語法
!prcb [Processor]
參數
Processor
指定要獲得PRCB信息的處理器。如果省略Processor,則使用處理器0。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
PRCB是處理器控制域(PCR)的一個擴展。使用!pcr 命令來顯示PCR。
下面是示例:
kd> !prcb
PRCB for Processor 0 at e0000000818ba000:
Threads-- Current e0000000818bbe10 Next 0000000000000000 Idle e0000000818bbe10
Number 0 SetMember 00000001
Interrupt Count -- 0000b81f
Times -- Dpc 00000028 Interrupt 000003ff
Kernel 00005ef4 User 00000385
附加信息
關於PCR和PRCB的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!process
!process 擴展顯示指定的進程或所有進程的信息,包括EPROCESS塊在內。
該命令只能在內核模式調試時使用。
語法
Windows NT 4.0的語法:
!process [Process [Flags]]
Windows 2000的語法:
!process [/s Session] [Process [Flags]]
!process [/s Session] 0 Flags ImageName
Windows XP和之後的語法:
!process [/s Session] [/m Module] [Process [Flags]]
!process [/s Session] [/m Module] 0 Flags ImageName
參數
/s Session
(Windows 2000和之後) 指定擁有給定進程的會話(session)。
/m Module
(Windows XP和之後) 指定擁有需要的進程的模塊。
Process
指定目標機上某個進程的16進制地址或者進程ID。
Process 的值決定了!process 命令顯示的是進程地址還是進程ID。如果在Windows NT 4.0中Process 爲-1 ,或在其他任何系統中省略掉,調試器只顯示當前系統進程的數據。如果Process 爲0 並且省略ImageName,調試器顯示所有活動進程的信息。
Flags
指定顯示內容的級別。Flags 可以是下面這些位的任意組合。如果Flags爲0,只會顯示很少的信息。默認值根據Windows版本和Process的值會有所不同。在Windows NT 4.0中,當Process被省略或者設置爲0時默認爲0x3,否則默認值爲0xF。在Windows 2000中,當Process省略,或者Process爲0並且省略ImageFile時,默認值是0x3;否則默認值爲0xF。在Windows XP和之後,當Process省略或者爲0或-1時,默認值爲0x3,否則爲0xF。
Bit 0 (0x1)
顯示時間和優先級統計。
Bit 1 (0x2)
顯示該進程關聯的線程和事件列表,以及它們的等待狀態。
Bit 2 (0x4)
顯示進程關聯的線程列表。如果沒有同時指定Bit 1(0x2),則每個線程顯示在單獨一行上。如果同時指定了Bit 1,則每個線程還會顯示堆棧回溯。
Bit 3 (0x8)
(Windows XP和之後) 顯示每個函數的返回地址、堆棧指針,以及(在Itanium系統上)bsp寄存器的值。不顯示函數的參數。
Bit 4 (0x10)
(Windows XP和之後) 在命令執行期間將進程上下文設定爲指定的進程。這樣會使得線程調用堆棧顯示更加精確。因爲該標誌相當於對這個進程使用了.process /p /r,會丟棄(discard)任何存在的用戶模式模塊列表。當Process 爲0時,調試器顯示所有進程,並且顯示每一個時都會切換進程上下文。如果只顯示單個進程,並且它的用戶模式狀態已經被刷新(例如,使用了.process /p /r),那麼就不需要使用這個標誌。該標誌僅在使用了 Bit 0(0x1)的時候起效。
ImageName
(Windows 2000和之後) 指定要顯示的進程的名字。調試器會顯示所有可執行映像名和ImageName 匹配的進程。映像名必須匹配EPROCESS 塊中的那個。一般來說,這是啓動了該進程的可執行文件的名字,包含擴展名(一般是.exe),並且第15個字符之後的字符被裁減掉。不能指定包含空格的映像名。指定了ImageName 時,Process 必須爲0。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是!process 0 0的顯示的示例:
kd> !process 0 0
**** NT ACTIVE PROCESS DUMP ****
PROCESS 80a02a60 Cid: 0002 Peb: 00000000 ParentCid: 0000
DirBase: 00006e05 ObjectTable: 80a03788 TableSize: 150.
Image: System
PROCESS 80986f40 Cid: 0012 Peb: 7ffde000 ParentCid: 0002
DirBase: 000bd605 ObjectTable: 8098fce8 TableSize: 38.
Image: smss.exe
PROCESS 80958020 Cid: 001a Peb: 7ffde000 ParentCid: 0012
DirBase: 0008b205 ObjectTable: 809782a8 TableSize: 150.
Image: csrss.exe
PROCESS 80955040 Cid: 0020 Peb: 7ffde000 ParentCid: 0012
DirBase: 00112005 ObjectTable: 80955ce8 TableSize: 54.
Image: winlogon.exe
PROCESS 8094fce0 Cid: 0026 Peb: 7ffde000 ParentCid: 0020
DirBase: 00055005 ObjectTable: 80950cc8 TableSize: 222.
Image: services.exe
PROCESS 8094c020 Cid: 0029 Peb: 7ffde000 ParentCid: 0020
DirBase: 000c4605 ObjectTable: 80990fe8 TableSize: 110.
Image: lsass.exe
PROCESS 809258e0 Cid: 0044 Peb: 7ffde000 ParentCid: 0026
DirBase: 001e5405 ObjectTable: 80925c68 TableSize: 70.
Image: SPOOLSS.EXE
這個表格是!process 0 0輸出中出現的各個部分的說明。
成員 |
含義 |
Process address |
單詞PROCESS 之後的8字符長度的16進制數字是EPROCESS塊的地址。上面例子中最後一條的進程地址爲0x809258E0。 |
Process ID (PID) |
Cid 後的16進制數字。上面例子中最後一條的PID是0x44,或者10進制的68。 |
Process Environment Block (PEB) |
Peb 後面的16進制數字是進程環境塊的地址 。上面例中最後一條的PEB位於0x7FFDE000。 |
Parent process PID |
ParentCid 後面的16進制數字是父進程的PID。上面例中最後一條的父進程PID爲0x26,或者10進制的38。 |
Image |
擁有該進程的模塊名。上例中最後一條的所有者爲spoolss.exe。第一條的所有者爲操作系統本身。 |
Process object address |
ObjectTable 後的16進制數字。上例最後一條中,進程對象(process object)地址爲0x80925c68。 |
要顯示某個進程的完整信息,可以將Flags設置爲7。可以將Process 設置爲進程地址、進程ID,或者將ImageName設置爲可執行映像的名字來指定進程。例如:
kd> !process fb667a00 7
PROCESS fb667a00 Cid: 0002 Peb: 00000000 ParentCid: 0000
DirBase: 00030000 ObjectTable: e1000f88 TableSize: 112.
Image: System
VadRoot fb666388 Clone 0 Private 4. Modified 9850. Locked 0.
FB667BBC MutantState Signalled OwningThread 0
Token e10008f0
ElapsedTime 15:06:36.0338
UserTime 0:00:00.0000
KernelTime 0:00:54.0818
QuotaPoolUsage[PagedPool] 1480
Working Set Sizes (now,min,max) (3, 50, 345)
PeakWorkingSetSize 118
VirtualSize 1 Mb
PeakVirtualSize 1 Mb
PageFaultCount 992
MemoryPriority BACKGROUND
BasePriority 8
CommitCharge 8
THREAD fb667780 Cid 2.1 Teb: 00000000 Win32Thread: 80144900 WAIT: (WrFreePage) KernelMode Non-Alertable
80144fc0 SynchronizationEvent
Not impersonating
Owning Process fb667a00
WaitTime (seconds) 32278
Context Switch Count 787
UserTime 0:00:00.0000
KernelTime 0:00:21.0821
Start Address Phase1Initialization (0x801aab44)
Initial Sp fb26f000 Current Sp fb26ed00
Priority 0 BasePriority 0 PriorityDecrement 0 DecrementCount 0
ChildEBP RetAddr Args to Child
fb26ed18 80118efc c0502000 804044b0 00000000 KiSwapThread+0xb5
fb26ed3c 801289d9 80144fc0 00000008 00000000 KeWaitForSingleObject+0x1c2
注意輸出中的進程對象的地址可以用於類似!handle這樣的其他擴展命令,用於獲得更多信息。
下面表格用於說明前面例子中的各個部分。
成員 |
含義 |
WAIT |
這個頭後面附加的註釋說明了等待原因。使用命令dt nt!_KWAIT_REASON 可以顯示所有等待原因的列表。 |
ElapsedTime |
列出從進程創建以來經過了多長時間。顯示是以Hours : Minutes: Seconds . Milliseconds格式的。 |
UserTime |
顯示進程在用戶模式下執行的時間。如果UserTime 特別高,可能說明了這個進程正在消耗系統資源。顯示格式和ElapsedTime一樣。 |
KernelTime |
顯示進程在內核模式下運行的時間。如果KernelTime 的值非常高,可能意味着該進程在消耗系統資源。顯示格式和ElapsedTime一樣。 |
Working Set sizes |
顯示進程當前的最小和最大工作集(working set)大小,以頁面數爲單位。如果工作集異常的大,說明進程可能存在內存泄露,或者消耗了很多系統資源。 |
QuotaPoolUsage entries |
列出進程使用的分頁和非分頁內存池。對存在內存泄露的系統,查看所有進程額外的非分頁內存使用可以知道哪個進程存在內存泄露。 |
Clone |
指示進程是否是由POSIX 或Interix字系統創建的。 |
Private |
指示進程當前使用到的私有(非共享)頁面數量。包括物理內存中的和已經換出的內存。 |
除了進程信息之外,線程信息中還包含被線程鎖定的資源列表。這個信息位於線程信息的第三行。上面例子中,線程鎖定了一個位於80144fc0處的SynchronizationEvent 資源。通過將該地址和!kdext*.locks擴展命令顯示的鎖的列表對比,可以知道哪個進程擁有資源的排它鎖(exclusive lock)。
!stacks 擴展給出每個線程的狀態的簡單摘要。它可以代替!process 用於對系統進行快速的查看,特別是調試像資源爭用或者死鎖這樣的多線程問題時。
附加信息
關於內核模式下進程的信息,查看改變上下文。關於對進程和線程進行分析的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
WinDbg 文檔翻譯----83
cc682/NetRoc
http://netroc682.spaces.live.com/
!pars
!pars 擴展顯示指定的processor application registers file。
語法
!pars Address
參數
Address
指定processor application registers file的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該命令只能對Itanium目標機使用。
!pat
!pat 顯示目標處理器的頁面屬性表寄存器(Page Attribute Table (PAT) registers)。
語法
!pat Flag
!pat
參數
Flag
如果設置Flag,調試器在顯示PAT之前會先驗證PAT功能是否存在。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展只能對x86目標機使用。
!pci
!pci 擴展命令用來顯示PCI(peripheral component interconnect)總線的當前狀態,以及附加到該總線上的任何設備。
語法
!pci [Flags [Bus [Device [Function [MinAddress MaxAddress]]]]]
參數
Flags
指定輸出級別。可以是下面這些位的任意組合:
Bit 0 (0x1)
顯示詳細輸出。
Bit 1 (0x2)
顯示從bus 0到指定的Bus範圍內的所有總線。
Bit 2 (0x4)
顯示中包含原始字節格式的信息。如果設置了MinAddress、MaxAddress,或者標誌的位0x8,則該標誌也自動被設置。
Bit 3 (0x8)
顯示中包含原始DWORD格式的信息。
Bit 4 (0x10)
顯示中包含無效設備的號碼(invalid device number)。如果指定了Device,則跳過該標誌。
Bit 5 (0x20)
顯示中包含無效功能號(invalid function numbers)。
Bit 6 (0x40)
顯示中包含capabilities。
Bit 7 (0x80)
顯示Intel 8086設備相關信息(Intel 8086 device-specific information)。
Bit 8 (0x100)
顯示PCI配置空間(PCI configuration space)。
Bus
指定要顯示的總線。Bus 可以在0到0xFF範圍之內。如果省略,則顯示primary bus (bus 0)的信息。如果Flags包含bit 1 (0x2), Bus 用於指定要顯示的最大一個總線號。
Device
指定設備的slot device number。如果省略,則顯示所有設備的信息。
Function
指定設備的slot function number。如果省略,則顯示所有的設備功能(device function)。
MinAddress
指定要顯示的原始字節或者原始DWORD的首地址。必須在0到0xFF之間。
MaxAddress
指定要顯示的原始字節或者原始DWORD的尾地址。必須在0到0xFF之間,並且不能比MinAddress 小。
DLL
Windows NT 4.0 |
Kext.dll |
Windows 2000 |
Kext.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能對x86目標機使用。
註釋
使用!ecb、!ecd、或者 !ecw來編輯PCI配置空間(PCI configuration space)。
下面的例子顯示了所有總線和它們的設備的列表。該命令需要較長時間來執行。調試器掃描目標系統的PCI總線時,在顯示的信息底部可以看到移動的計數器:
kd> !pci 2 ff
PCI Bus 0
00:0 8086:1237.02 Cmd[0106:.mb..s] Sts[2280:.....] Device Host bridge
0d:0 8086:7000.01 Cmd[0007:imb...] Sts[0280:.....] Device ISA bridge
0d:1 8086:7010.00 Cmd[0005:i.b...] Sts[0280:.....] Device IDE controller
0e:0 1011:0021.02 Cmd[0107:imb..s] Sts[0280:.....] PciBridge 0->1-1 PCI-PCI bridge
10:0 102b:0519.01 Cmd[0083:im....] Sts[0280:.....] Device VGA compatible controller
PCI Bus 1
08:0 10b7:9050.00 Cmd[0107:imb..s] Sts[0200:.....] Device Ethernet
09:0 9004:8178.00 Cmd[0117:imb..s] Sts[0280:.....] Device SCSI controller
下面的例子顯示primary bus 上設備的詳細信息。每行開頭的兩位數字是設備號(device number),後面跟的一位數字是功能號(function number):
kd> !pci 1 0
PCI Bus 0
00:0 8086:1237.02 Cmd[0106:.mb..s] Sts[2280:.....] Device Host bridge
cf8:80000000 IntPin:0 IntLine:0 Rom:0 cis:0 cap:0
0d:0 8086:7000.01 Cmd[0007:imb...] Sts[0280:.....] Device ISA bridge
cf8:80006800 IntPin:0 IntLine:0 Rom:0 cis:0 cap:0
0d:1 8086:7010.00 Cmd[0005:i.b...] Sts[0280:.....] Device IDE controller
cf8:80006900 IntPin:0 IntLine:0 Rom:0 cis:0 cap:0
IO[4]:fff1
0e:0 1011:0021.02 Cmd[0107:imb..s] Sts[0280:.....] PciBridge 0->1-1 PCI-PCI bridge
cf8:80007000 IntPin:0 IntLine:0 Rom:0 cap:0 2sts:2280 BCtrl:6 ISA
IO:f000-ffff Mem:fc000000-fdffffff PMem:fff00000-fffff
10:0 102b:0519.01 Cmd[0083:im....] Sts[0280:.....] Device VGA compatible controller
cf8:80008000 IntPin:1 IntLine:9 Rom:80000000 cis:0 cap:0
MEM[0]:fe800000 MPF[1]:fe000008
下面的例子顯示bus 0,設備0x0D,功能0x01的更詳細一些的信息,包括從地址0x00到0x3F之間的原始DWORD值:
kd> !pci f 0 d 1 0 3f
PCI Bus 0
0d:1 8086:7010.00 Cmd[0005:i.b...] Sts[0280:.....] Device IDE controller
cf8:80006900 IntPin:0 IntLine:0 Rom:0 cis:0 cap:0
IO[4]:fff1
00000000: 70108086 02800005 01018000 00002000
00000010: 00000000 00000000 00000000 00000000
00000020: 0000fff1 00000000 00000000 00000000
00000030: 00000000 00000000 00000000 00000000
附加信息
查看Plug and Play 調試獲得該擴展命令的應用和更多示例。關於PCI總線的信息,查看Windows Driver Kit (WDK)文檔。
!pciir
!pciir 擴展顯示從PCI設備到中斷控制器輸入(interrupt controller input)的硬件路由(hardware routing)的內容。
語法
!pciir
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP |
Kdexts.dll |
Windows Vista和之後 |
不可用 |
該擴展命令只能在未啓用ACPI(Advanced Configuration and Power Interface)的x86目標機上使用。
附加信息
使用!acpiirqarb 擴展在啓用ACPI的機器上查看類似信息。
關於PCI總線的信息,查看Windows Driver Kit (WDK)文檔。
!pcitree
!pcitree 擴展顯示PCI設備對象的信息,包括子PCI總線和CardBus總線,以及附加到他們上的設備。
語法
!pcitree
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是一個示例:
kd> !pcitree
Bus 0x0 (FDO Ext fe517338)
0600 12378086 (d=0, f=0) devext fe4f4ee8 Bridge/HOST to PCI
0601 70008086 (d=d, f=0) devext fe4f4ce8 Bridge/PCI to ISA
0101 70108086 (d=d, f=1) devext fe4f4ae8 Mass Storage Controller/IDE
0604 00211011 (d=e, f=0) devext fe4f4788 Bridge/PCI to PCI
Bus 0x1 (FDO Ext fe516998)
0200 905010b7 (d=8, f=0) devext fe515ee8 Network Controller/Ethernet
0100 81789004 (d=9, f=0) devext fe515ce8 Mass Storage Controller/SCSI
0300 0519102b (d=10, f=0) devext fe4f4428 Display Controller/VGA
Total PCI Root busses processed = 1
要根據最後的設備顯示來理解輸出的內容。它的base class 爲03、subclass 爲00、Device ID 爲0x0519,、Vendor ID 爲0x102B。這些值是設備本身固有的。
"d="後面的數字是設備號;"f="後的數字是功能號(function number)。"devext"後是設備擴展的地址: 0xFE4F4428。最後顯示base class 名字和subclass名字。
要獲得某個設備的更多信息,可以使用!devext 擴展命令,並且將設備擴展地址作爲參數。對這類設備,命令應該像下面一樣:
kd> !devext fe4f4428 pci
如果!pcitree 擴展產生一個錯誤,通常意味着PCI符號沒有正確的加載。使用.reload pci.sys來修正這個問題。
附加信息
查看Plug and Play調試來獲得該擴展命令的應用。關於PCI總線和PCI設備對象的信息,查看 Windows Driver Kit (WDK)文檔。
!pcm
!pcm 擴展顯示指定的private cache map。該擴展僅在Windows 2000中可用。
語法
!pcm Address
參數
Address
指定private cache map的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
不可用(查看註釋節) |
註釋
該擴展僅在Windwos 2000中支持。在Windows XP和之後的Windows中,可以使用dt nt!_PRIVATE_CACHE_MAP Address命令。
附加信息
關於緩存管理的信息,查看Microsoft Windows SDK 文檔,以及Mark Russinovich 和David Solomon編寫的Microsoft Windows Internals。
其他緩存管理命令的信息,可以查看!cchelp擴展的參考。
!pcr
!pcr 擴展顯示指定處理器上的處理器控制域(Processor Control Region (PCR))的當前狀態。
語法
!pcr [Processor]
參數
Processor
指定要獲取哪個處理器的PCR信息。如果省略Processor,則使用當前處理器。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
處理器控制塊(PRCB)是PCR的一個擴展。可以通過!prcb 命令來顯示。
下面是x86目標機上的!pcr擴展命令的示例:
kd> !pcr 0
KPCR for Processor 0 at ffdff000:
Major 1 Minor 1
NtTib.ExceptionList: 801626e0
NtTib.StackBase: 801628f0
NtTib.StackLimit: 8015fb00
NtTib.SubSystemTib: 00000000
NtTib.Version: 00000000
NtTib.UserPointer: 00000000
NtTib.SelfTib: 00000000
SelfPcr: ffdff000
Prcb: ffdff120
Irql: 00000000
IRR: 00000000
IDR: ffffffff
InterruptMode: 00000000
IDT: 80043400
GDT: 80043000
TSS: 803cc000
CurrentThread: 8015e8a0
NextThread: 00000000
IdleThread: 8015e8a0
DpcQueue: 0x80168ee0 0x80100d04 ntoskrnl!KiTimerExpiration
顯示中的一個條目是中斷請求級別(IRQL)。!pcr 擴展顯示的是當前IRQL,但是通常對當前IRQL都不是很感興趣。Bug check或者調試器連接之前的IRQL要更加有用一些。可以通過!irql來顯示這種IRQL,但是隻有針對運行Windows Server2003和之後版本Windows的機器纔有用。
附加信息
關於PCR和PRCB的更多信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!pcrs
!pcrs 擴展命令顯示Intel Itanium處理器的控制寄存器(control register)。
語法
!pcrs Address
參數
Address
指定processor control registers file的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能對Itanium目標機使用。
註釋
不要將!pcrs擴展和 !pcr 混淆,後者用來顯示處理器控制域(processor control region)的當前狀態。
!pfn
!pfn 擴展用於顯示指定的頁面幀(page frame)或者整個頁面幀數據庫(page frame database)。
語法
!pfn PageFrame
參數
PageFrame
指定要顯示的頁面幀的16進制序號。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
可以通過!pte擴展獲得某個虛擬地址的頁面幀序號。
下面是該擴展的輸出示例:
kd> !pte 801544f4
801544F4 - PDE at C0300800 PTE at C0200550
contains 0003B163 contains 00154121
pfn 3b G-DA--KWV pfn 154 G--A--KRV
kd> !pfn 3b
PFN 0000003B at address 82350588
flink 00000000 blink / share count 00000221 pteaddress C0300800
reference count 0001 color 0
restore pte 00000000 containing page 000039 Active
kd> !pfn 154
PFN 00000154 at address 82351FE0
flink 00000000 blink / share count 00000001 pteaddress C0200550
reference count 0001 color 0
restore pte 00000060 containing page 00003B Active M
Modified
附加信息
關於頁表、頁目錄、頁面幀的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!pmc
!pmc 擴展顯示指定地址處的性能監控計數器(Performance Monitor Counter (PMC))寄存器。
該命令僅在Itanium目標機上支持。
語法
!pmc [- Option] Expression [DisplayLevel]
參數
Option
可以是下面這些值中任意一個:
gen
將該寄存器當作常規PMC寄存器顯示。
btb
將該寄存器當作branch trace buffer (BTB) PMC寄存器進行顯示。
Expression
指定PMC的16進制地址。可以使用表達式@kpfcgen 和@kpfcbtb 用作參數的值。
如果Expression 是@kpfcgen,調試器將當前處理器的PMC寄存器當作常規PMC寄存器顯示。還可以通過將Option 設置爲gen,並且Expression 值使用@kpfc4、@kpfc5、@kpfc6或者@kpfc7來將當前處理器的PMC寄存器作爲常規PMC寄存器顯示。
如果Expression 爲@kpfcbtb,調試器將當前處理器的PMC寄存器當作BTB PMC寄存器顯示。也可以通過Optio設置爲btb,並且Expression 的值使用@kpfc12來當作BTB PMC寄存器顯示。
DisplayLevel
可以是下面這些值中任意一個:
0
僅顯示每個PMC寄存器字段的值。這是默認情況。
1
顯示非保留和非忽略的PCM寄存器字段的詳細信息。
2
顯示所有PMC寄存器字段的詳細信息,包括被忽略的和保留的。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
!pmssa
!pmssa 擴展顯示指定的processor Minimal State Save Area (也稱爲Min-StateSave Area)。
該擴展命令僅在Itanium目標機上可用。
語法
!pmssa Address
參數
Address
指定某個processor Min-StateSave Area的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
!pnpevent
!pnpevent 擴展顯示即插即用(Plug and Play)設備事件隊列。
語法
!pnpevent [DeviceEvent]
參數
DeviceEvent
指定要顯示的設備事件(device event)的地址。如果爲0或者省略,則顯示該隊列中所有設備事件的樹(tree)。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
附加信息
查看Plug and Play調試獲得該擴展命令的應用。關於Plug and Play驅動程序的信息,查看Windows Driver Kit (WDK) 文檔。
!pocaps
!pocaps 擴展顯示目標機的電源能力(power capability)。
語法
!pocaps
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該命令輸出的示例:
kd> !pocaps
PopCapabilities @ 0x8016b100
Misc Supported Features: S4 FullWake
Processor Features:
Disk Features: SpinDown
Battery Features:
Wake Caps
Ac OnLine Wake: Sx
Soft Lid Wake: Sx
RTC Wake: Sx
Min Device Wake: Sx
Default Wake: Sx
附加信息
要查看系統的電源策略(power policy),可以使用!popolicy 擴展命令。關於電源能力和電源策略的更多信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!pool
!pool擴展顯示指定的內存池分配的信息,或者整個系統範圍內內存池的分配信息。
語法
!pool [Address [Flags]]
參數
Address
指定要顯示的內存池入口。如果Address是 -1,該命令顯示進程中所有堆(all heaps in the process)的信息。如果Address 爲0或省略,命令顯示進程堆(process heap)的信息。
Flags
指定顯示的級別。可以是下面這些位值的任意組合,默認值爲0:
Bit 0 (0x1)
顯示內存池內容,而不僅僅是頭部(pool header)。
Bit 1 (0x2)
(Windows 2000和之後) 不顯示所有內存池的頭信息,除了實際包含指定的Address的那個。
Bit 31 (0x80000000)
(Windows XP和之後) 不顯示池類型(type)和標籤(tag)。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
在Windows XP和之後版本的Windows中,!pool 擴展顯示每個分配關聯的內存池標籤(pool tag)。還會顯示該標籤的所有者。顯示是基於pooltag.txt 文件的內容的。該文件位於Windwos調試工具包安裝目錄的triage 子目錄下。如果需要的話,可以通過編輯該文件來添加自己的項目相關的其他pool tag。
警告 如果在當前版本安裝的目錄上安裝Windwos調試工具包的升級版本,則它會覆蓋該目錄中所有文件,包括pooltag.txt。如果改變或者替換了示例的pooltag.txt,則要將它先保存到其他目錄中。重新安裝調試器之後,可以再用保存的那個pooltag.txt來進行覆蓋。
如果!pool 擴展報告內存池破壞,應該使用!poolval來進行調查。
下面是一個例子。如果Address 指定0xE1001050,則顯示這個塊中的所有內存池的頭部,並且0xE1001050本身用星號(*)標記。
kd> !pool e1001050
e1001000 size: 40 previous size: 0 (Allocated) MmDT
e1001040 size: 10 previous size: 40 (Free) Mm
*e1001050 size: 10 previous size: 10 (Allocated) *ObDi
e1001060 size: 10 previous size: 10 (Allocated) ObDi
e1001070 size: 10 previous size: 10 (Allocated) Symt
e1001080 size: 40 previous size: 10 (Allocated) ObDm
e10010c0 size: 10 previous size: 40 (Allocated) ObDi
.....
這個例子中,最右邊的一列是pool tag。這一列左邊顯示這個pool是空閒的還是已分配的。
下面的命令顯示內存池頭部和內容(pool headers and pool contents):
kd> !pool e1001050 1
e1001000 size: 40 previous size: 0 (Allocated) MmDT
e1001008 ffffffff 0057005c 004e0049 004f0044
e1001018 ffffffff 0053005c 00730079 00650074
e1001040 size: 10 previous size: 40 (Free) Mm
e1001048 ffffffff e1007ba8 e1501a58 01028101
e1001058 ffffffff 00000000 e1000240 01028101
*e1001050 size: 10 previous size: 10 (Allocated) *ObDi
e1001058 ffffffff 00000000 e1000240 01028101
e1001068 ffffffff 00000000 e10009c0 01028101
e1001060 size: 10 previous size: 10 (Allocated) ObDi
e1001068 ffffffff 00000000 e10009c0 01028101
e1001078 ffffffff 00000000 00000000 04028101
......
附加信息
關於內存池的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
WinDbg 文檔翻譯----82
cc682/NetRoc
http://netroc682.spaces.live.com/
!mca
在x86目標機上,!mca 擴展用於顯示機器檢查架構(machine check architecture (MCA))寄存器。在Itanium目標機上,!mca用於顯示MCA錯誤記錄。
語法
x86 目標機語法
!mca
Itanium目標機語法
!mca Address [Flags]
參數
Address
(僅Itanium目標) 指定MCA錯誤記錄的地址。
Flags
(僅Itanium目標) 指定顯示級別。Flags 可以是下面這些位的任意組合。默認值爲0xFF,會顯示日誌中的所有部分(section)。
Bit 0 (0x1)
顯示處理器部分(section)。
Bit 1 (0x2)
顯示平臺相關部分(platform-specific section)。
Bit 2 (0x4)
顯示內存部分(memory section)
Bit 3 (0x8)
顯示PCI組件部分。
Bit 4 (0x10)
顯示PCI總線部分。
Bit 5 (0x20)
顯示SystemEvent Log部分。
Bit 6 (0x40)
顯示平臺控制器(platform host controller)部分。
Bit 7 (0x80)
顯示平臺總線(platform bus)部分。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能針對x86或Itanium目標機使用。
註釋
在Itanium目標上,!mca 顯示系統抽象層(system abstraction layer (SAL))中的MCA錯誤記錄。下面是該擴展輸出的示例:
kd> !mca e0000165f3f58000
hal!HalpFeatureBits: 0xf [HAL_PERF_EVENTS|HAL_MCA_PRESENT|HAL_CMC_PRESENT|HAL_CPE_PRESENT]
MCA Error Record Header @ 0xe0000165f3f58000 0xe0000165f3f597a8
Id : 8
Revision :
Revision : 2
Minor : 0x2 ''
Major : 0 ''
ErrorSeverity : 0 ''
Valid :
Valid : 0 ''
OemPlatformID : 0y0
Reserved : 0y0000000 (0)
Length : 0x17a8
TimeStamp :
TimeStamp : 0x20031106`00134944
Seconds : 0x44 'D'
Minutes : 0x49 'I'
Hours : 0x13 ''
Reserved : 0 ''
Day : 0x6 ''
Month : 0x11 ''
Year : 0x3 ''
Century : 0x20 ' '
OemPlatformId : [16] ""
Severity : ErrorRecoverable
MCA Error Section Header @ 0xe0000165f3f58028 0xe0000165f3f59578 [Processor]
Header :
Guid :
Data1 : 0xe429faf1
Data2 : 0x3cb7
Data3 : 0x11d4
Data4 : [8] "???"
Revision :
Revision : 2
Minor : 0x2 ''
Major : 0 ''
RecoveryInfo :
RecoveryInfo : 0 ''
Corrected : 0y0
NotContained : 0y0
Reset : 0y0
Reserved : 0y0000
Valid : 0y0
Reserved : 0 ''
Length : 0x1550
Valid :
Valid : 0x100101f
ErrorMap : 0y1
StateParameter : 0y1
CRLid : 0y1
StaticStruct : 0y1
CacheCheckNum : 0y0001
TlbCheckNum : 0y0000
BusCheckNum : 0y0001
RegFileCheckNum : 0y0000
MsCheckNum : 0y0000
CpuIdInfo : 0y1
Reserved : 0y000000000000000000000000000000000000000 (0)
ErrorMap :
ErrorMap : 0x1002000
Cid : 0y0000
Tid : 0y0000
Eic : 0y0000
Edc : 0y0010
Eit : 0y0000
Edt : 0y0000
Ebh : 0y0001
Erf : 0y0000
Ems : 0y0000000000000000 (0)
Reserved : 0y0000000000000000 (0)
StateParameter :
StateParameter : 0x28000000`fff21130
reserved0 : 0y00
rz : 0y0
ra : 0y0
me : 0y1
mn : 0y1
sy : 0y0
co : 0y0
ci : 0y1
us : 0y0
hd : 0y0
tl : 0y0
mi : 0y1
pi : 0y0
pm : 0y0
dy : 0y0
in : 0y0
rs : 0y1
cm : 0y0
ex : 0y0
cr : 0y1
pc : 0y1
dr : 0y1
tr : 0y1
rr : 0y1
ar : 0y1
br : 0y1
pr : 0y1
fp : 0y1
b1 : 0y1
b0 : 0y1
gr : 0y1
dsize : 0y0000000000000000 (0)
reserved1 : 0y00000000000 (0)
cc : 0y1
tc : 0y0
bc : 0y1
rc : 0y0
uc : 0y0
CRLid :
LocalId : 0
reserved : 0y0000000000000000 (0)
eid : 0y00000000 (0)
id : 0y00000000 (0)
ignored : 0y00000000000000000000000000000000 (0)
CacheErrorInfo[0]:
Valid : 1
CheckInfo : 0y1
RequestorIdentifier : 0y0
ResponderIdentifier : 0y0
TargetIdentifier : 0y0
PreciseIP : 0y0
Reserved : 0y00000000000000000000000000000000000000000000000000000000000 (0)
CheckInfo : 0x0
RequestorId : 0x0
ResponderId : 0x0
TargetIp : 0x0
TargetId : 0x0
PreciseIp : 0x0
CheckInfo:
CacheCheck : 0
Operation : 0y0000
Level : 0y00
Reserved1 : 0y00
DataLine : 0y0
TagLine : 0y0
DataCache : 0y0
InstructionCache : 0y0
MESI : 0y000
MESIValid : 0y0
Way : 0y00000 (0)
WayIndexValid : 0y0
Reserved2 : 0y0000000000 (0)
Index : 0y00000000000000000000 (0)
Reserved3 : 0y00
InstructionSet : 0y0
InstructionSetValid : 0y0
PrivilegeLevel : 0y00
PrivilegeLevelValid : 0y0
MachineCheckCorrected : 0y0
TargetAddressValid : 0y0
RequestIdValid : 0y0
ResponderIdValid : 0y0
PreciseIPValid : 0y0
BusErrorInfo[0]:
Valid : 9
CheckInfo : 0y1
RequestorIdentifier : 0y0
ResponderIdentifier : 0y0
TargetIdentifier : 0y1
PreciseIP : 0y0
Reserved : 0y00000000000000000000000000000000000000000000000000000000000 (0)
CheckInfo : 0x1080000003000144
RequestorId : 0x0
ResponderId : 0x0
TargetIp : 0x0
TargetId : 0xd0022004
PreciseIp : 0x0
CheckInfo:
BusCheck : 0x10800000`03000144
Size : 0y00100 (0x4)
Internal : 0y0
External : 0y1
CacheTransfer : 0y0
Type : 0y00000001 (0x1)
Severity : 0y00000 (0)
Hierarchy : 0y00
Reserved1 : 0y0
Status : 0y00000011 (0x3)
Reserved2 : 0y0000000000000000000000 (0)
InstructionSet : 0y0
InstructionSetValid : 0y1
PrivilegeLevel : 0y00
PrivilegeLevelValid : 0y0
MachineCheckCorrected : 0y0
TargetAddressValid : 0y1
RequestIdValid : 0y0
ResponderIdValid : 0y0
PreciseIPValid : 0y0
StaticInfo @ 0xe0000165f3f580f0 0xe0000165f3f59578
Valid @ 0xe0000165f3f580f0
Valid : 0x3f
MinState : 0y1
BR : 0y1
CR : 0y1
AR : 0y1
RR : 0y1
FR : 0y1
Reserved : 0y0000000000000000000000000000000000000000000000000000000000 (0)
MinState @ 0xe0000165f3f580f8 0xe0000165f3f584f0
IntNats : 0
IntGp : 0xe0000165`f1a99b00
IntT0 : 0
IntT1 : 0xe0f0e0f0`e0f0e000
IntS0 : 0
IntS1 : 1
IntS2 : 0xe0000000`83068300
IntS3 : 0xe0000000`832f8780
IntV0 : 0x4600
IntT2 : 0x230
IntT3 : 0x3ff
IntT4 : 0xe0000165`f38c6000
IntSp : 0xe0000165`f0f97da0
IntTeb : 0
IntT5 : 0
IntT6 : 0xfffff630
B0R16 : 0x1010`082a6018
B0R17 : 0
B0R18 : 0xe0000000`830067c0
B0R19 : 0x101
B0R20 : 0x80000000`00000308
B0R21 : 0
B0R22 : 0xe0000000`84bedd20
B0R23 : 0xe0000000`84bedd20
B0R24 : 0xe0000165`f213df5a
B0R25 : 0xfff80000`597c84f0
B0R26 : 0x6081
B0R27 : 0xfffffe00`00165f20
B0R28 : 0x8000465
B0R29 : 0x8000465
B0R30 : 0x60
B0R31 : 0xa04`00000000
IntT7 : 0x44
IntT8 : 0x200
IntT9 : 0xe0000165`f38c6000
IntT10 : 0xe0000165`f3cb81bc
IntT11 : 0xe0000165`f3cb81b8
IntT12 : 0xe0000000`8363f7b0
IntT13 : 0xe0000165`f1899d08
IntT14 : 0x9804c`8a70433f
IntT15 : 0xe0000000`832821f8
IntT16 : 0xe0000000`836536e0
IntT17 : 0xe0000000`8363f7b8
IntT18 : 0xffffffff`fffffbc3
IntT19 : 0xe0000165`f1ff6000
IntT20 : 0x2400580
IntT21 : 0xe0000165`f1ff6004
IntT22 : 0xe0000165`f3cb8dc0
Preds : 0x2277
BrRp : 0xe0000165`ea212df0
RsRSC : 3
StIIP : 0xe0000165`f1895370
StIPSR : 0x1010`082a6018
StIFS : 0x80000000`00000285
XIP : 0xe0000165`ea212c50
XPSR : 0x1010`082a6018
XFS : 0x80000000`00000b1c
BR @ 0xe0000165f3f584f8 0xe0000165f3f58530
e0000165`f3f584f8 e0000165`ea212df0 USBPORT!USBPORT_StopDevice+0x850
e0000165`f3f58500 00000000`00000000
e0000165`f3f58508 00000000`00000000
e0000165`f3f58510 00000000`00000000
e0000165`f3f58518 00000000`00000000
e0000165`f3f58520 00000000`00000000
e0000165`f3f58528 e0000000`832cb061 nt!NtClose+0x1
e0000165`f3f58530 e0000165`f1895320 usbohci!OHCI_StopController
CR @ 0xe0000165f3f58538 0xe0000165f3f58930
e0000165`f3f58538 00000000`00007e05
e0000165`f3f58540 00000154`a7047201
e0000165`f3f58548 e0000000`83230000 nt!KiVhptTransVector
e0000165`f3f58550 00000000`00000000
...
e0000165`f3f585c8 00000000`00000000
e0000165`f3f585d0 e0000165`f1895370 usbohci!OHCI_StopController+0x50
e0000165`f3f585d8 e0000165`f213df5a
e0000165`f3f585e0 00000000`00000060
e0000165`f3f585e8 e0000165`f1895360 usbohci!OHCI_StopController+0x40
e0000165`f3f585f0 80000000`00000285
...
e0000165`f3f58930 00000000`00000000
AR @ 0xe0000165f3f58938 0xe0000165f3f58d30
e0000165`f3f58938 00000000`00000000
e0000165`f3f58940 00000000`00000000
e0000165`f3f58948 00000000`00000000
e0000165`f3f58950 00000000`00000000
e0000165`f3f58958 00000000`00000000
e0000165`f3f58960 00000000`00000006
e0000165`f3f58968 e0000000`8301add0 nt!KiMemoryFault
e0000165`f3f58970 00000000`00000000
e0000165`f3f58978 00000000`00000000
e0000165`f3f58980 00000000`00000000
e0000165`f3f58988 00000000`00000000
e0000165`f3f58990 00000000`00000000
e0000165`f3f58998 00000000`00000000
e0000165`f3f589a0 00000000`00000000
e0000165`f3f589a8 00000000`00000000
e0000165`f3f589b0 00000000`00000000
e0000165`f3f589b8 e0000165`f1895370 usbohci!OHCI_StopController+0x50
e0000165`f3f589c0 e0000165`f0f988e0
...
e0000165`f3f58d30 00000000`00000000
RR @ 0xe0000165f3f58d38 0xe0000165f3f58d70
e0000165`f3f58d38 00000000`00000535
e0000165`f3f58d40 00000000`00000535
e0000165`f3f58d48 00000000`00000535
e0000165`f3f58d50 00000000`00000535
e0000165`f3f58d58 00000000`00000535
e0000165`f3f58d60 00000000`00000535
e0000165`f3f58d68 00000000`00000535
e0000165`f3f58d70 00000000`00000535
FR @ 0xe0000165f3f58d78 0xe0000165f3f59570
e0000165`f3f58d78 00000000`00000000
e0000165`f3f58d80 00000000`00000000
e0000165`f3f58d88 80000000`00000000
e0000165`f3f58d90 00000000`0000ffff
e0000165`f3f58d98 00000000`00000000
e0000165`f3f58da0 00000000`00000000
e0000165`f3f58da8 00000000`00000000
e0000165`f3f58db0 00000000`00000000
...
e0000165`f3f59570 00000000`00000000
MCA Error Section Header @ 0xe0000165f3f59578 0xe0000165f3f596a0 [PciComponent]
Header :
Guid :
Data1 : 0xe429faf6
Data2 : 0x3cb7
Data3 : 0x11d4
Data4 : [8] "???"
Revision :
Revision : 2
Minor : 0x2 ''
Major : 0 ''
RecoveryInfo :
RecoveryInfo : 0x80 ''
Corrected : 0y0
NotContained : 0y0
Reset : 0y0
Reserved : 0y0000
Valid : 0y1
Reserved : 0 ''
Length : 0x128
Valid :
Valid : 0x23
ErrorStatus : 0y1
Info : 0y1
MemoryMappedRegistersPairs : 0y0
ProgrammedIORegistersPairs : 0y0
RegistersDataPairs : 0y0
OemData : 0y1
Reserved : 0y0000000000000000000000000000000000000000000000000000000000 (0)
ErrorStatus :
Status : 0x121900
Reserved0 : 0y00000000 (0)
Type : 0y00011001 (0x19)
Address : 0y0
Control : 0y1
Data : 0y0
Responder : 0y0
Requestor : 0y1
FirstError : 0y0
Overflow : 0y0
Reserved1 : 0y00000000000000000000000000000000000000000 (0)
Info :
VendorId : 0x8086
DeviceId : 0x100e
ClassCodeInterface : 0 ''
ClassCodeSubClass : 0 ''
ClassCodeBaseClass : 0x2 ''
FunctionNumber : 0 ''
DeviceNumber : 0x3 ''
BusNumber : 0xa0 ''
SegmentNumber : 0 ''
Reserved0 : 0 ''
Reserved1 : 0
MemoryMappedRegistersPairs : 0
ProgrammedIORegistersPairs : 0
OemData @ 0xe0000165f3f595b8 0xe0000165f3f596a0
Data Length = 0xe6
Data:
e0000165`f3f595ba 00 00 00 00 00 00 91 d3-86 d3 7a 5e 7e 48 a4 0a ..........z^~H..
e0000165`f3f595ca 2b f6 f7 a6 cc ca 00 ff-ff ff ff ff ff ff 09 00 +...............
e0000165`f3f595da 00 00 00 00 00 00 00 00-00 00 08 00 00 00 86 80 ................
e0000165`f3f595ea 0e 10 47 01 30 22 08 00-00 00 08 00 00 00 02 00 ..G.0"..........
e0000165`f3f595fa 00 02 20 80 00 00 10 00-00 00 08 00 00 00 00 00 .. .............
e0000165`f3f5960a 00 d0 00 00 00 00 18 00-00 00 08 00 00 00 81 a0 ................
e0000165`f3f5961a 00 00 00 00 00 00 20 00-00 00 08 00 00 00 00 00 ...... .........
e0000165`f3f5962a 00 00 00 00 00 00 28 00-00 00 08 00 00 00 00 00 ......(.........
e0000165`f3f5963a 00 00 3c 10 74 12 30 00-00 00 08 00 00 00 00 00 ..<.t.0.........
e0000165`f3f5964a 00 00 dc 00 00 00 38 00-00 00 08 00 00 00 00 00 ......8.........
e0000165`f3f5965a 00 00 2a 01 ff 00 e4 00-00 00 08 00 00 00 07 f0 ..*.............
e0000165`f3f5966a 1e 00 00 00 40 04 00 00-00 00 00 00 00 00 00 00 ....@...........
e0000165`f3f5967a 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
e0000165`f3f5968a 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00 ................
e0000165`f3f5969a 00 00 00 00 00 00 ......
MCA Error Section Header @ 0xe0000165f3f596a0 0xe0000165f3f597a8 [PciBus]
Header :
Guid :
Data1 : 0xe429faf4
Data2 : 0x3cb7
Data3 : 0x11d4
Data4 : [8] "???"
Revision :
Revision : 2
Minor : 0x2 ''
Major : 0 ''
RecoveryInfo :
RecoveryInfo : 0x84 ''
Corrected : 0y0
NotContained : 0y0
Reset : 0y1
Reserved : 0y0000
Valid : 0y1
Reserved : 0 ''
Length : 0x108
Valid :
Valid : 0x74f
ErrorStatus : 0y1
ErrorType : 0y1
Id : 0y1
Address : 0y1
Data : 0y0
CmdType : 0y0
RequestorId : 0y1
ResponderId : 0y0
TargetId : 0y1
OemId : 0y1
OemData : 0y1
Reserved : 0y00000000000000000000000000000000000000000000000000000 (0)
ErrorStatus :
Status : 0x121900
Reserved0 : 0y00000000 (0)
Type : 0y00011001 (0x19)
Address : 0y0
Control : 0y1
Data : 0y0
Responder : 0y0
Requestor : 0y1
FirstError : 0y0
Overflow : 0y0
Reserved1 : 0y00000000000000000000000000000000000000000 (0)
Type :
Type : 0x4 ''
Reserved : 0 ''
Id :
BusNumber : 0xa0 ''
SegmentNumber : 0 ''
Reserved : [4] ""
Address : 0xd0022054
Data : 0
CmdType : 0
RequestorId : 0xfed2a000
ResponderId : 0
TargetId : 0xd0022054
OemId : [16] ".???"
OemData :
Length : 0x98
CP M/R/F/A Manufacturer SerialNumber Features Speed
0 1,5,31,0 GenuineIntel 0000000000000000 0000000000000001 1000 Mhz
在x86目標上,!mca 顯示由活動處理器支持的machine check 寄存器。還會顯示基本的CPU信息(和!cpuinfo顯示的一樣)。下面是該擴展的輸出示例:
0: kd> !mca
MCE: Enabled, Cycle Address: 0x00000001699f7a00, Type: 0x0000000000000000
MCA: Enabled, Banks 5, Control Reg: Supported, Machine Check: None.
Bank Error Control Register Status Register
0. None 0x000000000000007f 0x0000000000000000
1. None 0x00000000ffffffff 0x0000000000000000
2. None 0x00000000000fffff 0x0000000000000000
3. None 0x0000000000000007 0x0000000000000000
4. None 0x0000000000003fff 0x0000000000000000
No register state available.
CP F/M/S Manufacturer MHz Update Signature Features
0 15,5,0 SomeBrandName 1394 0000000000000000 a0017fff
注意該擴展需要HAL的私有符號。如果沒有這些符號,擴展命令會顯示信息"HalpFeatureBits not found",以及基本CPU信息。例如 :
kd> !mca
HalpFeatureBits not found
CP F/M/S Manufacturer MHz Update Signature Features
0 6,5,1 GenuineIntel 334 0000004000000000 00001fff
!memlist
!memlist 擴展用來掃描頁面幀序號數據庫(page frame number (PFN) database)中的物理內存列表,以檢查它們的一致性。
語法
!memlist Flags
參數
Flags
指定要校驗的內存。目前只實現了下面這一個值:
Bit 0 (0x1)
校驗零頁面列表(zeroed pages list)。
DLL
Windows NT 4.0 |
Kdexts.dll |
Windows 2000 |
Kdexts.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
目前,該擴展命令只檢查零頁面列表(zeroed pages list )來確認是否該列表中所有頁面都被用0填充了。使用的語法如下:
kd> !memlist 1
!memusage
!memusage 擴展顯示物理內存使用的摘要統計。
語法
Windows 2000和之後的語法
!memusage
Windows XP和之後的語法
!memusage [Flags]
Flags
(Windows XP和之後) 可以是下面這些值的任意一個。默認爲0x0。
0x0
顯示一般摘要信息,以及對PFN數據庫中的頁面更詳細一些的說明。查看註釋節獲得這種輸出的示例。
0x1
僅顯示PFN數據庫中已修改的非寫頁面(no-write page)的摘要信息。
0x2
僅顯示PFN數據庫中已修改的非寫頁面(no-write page)的詳細信息。
0x8
僅顯示內存使用的一般摘要信息。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
物理內存統計是由內存管理器(Memory Manager)的頁面幀序號(PFN)數據庫蒐集的。
由於需要獲取大量數據,該命令需要運行較長時間,特別是當目標機運行在64位模式時。加載PFN數據庫時,會由一個計數器來顯示進度。要加快這種加載,可以通過CTRL+A (Toggle Baud Rate) 鍵增加COM口的速度,或者使用, .cache (Set Cache Size) 命令增加緩存大小(可能大約在10 MB左右)。
!memusage 命令也可以在本地內核調試時使用。
下面是該命令輸出的一個例子:
kd> !memusage
loading PFN database
loading (98% complete)
Compiling memory usage data (100% Complete).
Zeroed: 49 ( 196 kb)
Free: 5 ( 20 kb)
Standby: 5489 ( 21956 kb)
Modified: 714 ( 2856 kb)
ModifiedNoWrite: 1 ( 4 kb)
Active/Valid: 10119 ( 40476 kb)
Transition: 6 ( 24 kb)
Unknown: 0 ( 0 kb)
TOTAL: 16383 ( 65532 kb)
Building kernel map
Finished building kernel map
Scanning PFN database - (99% complete)
Usage Summary (in Kb):
Control Valid Standby Dirty Shared Locked PageTables name
8251a258 12 108 0 0 0 0 mapped_file( cscui.dll )
827ab1b8 8 1708 0 0 0 0 mapped_file( $Mft )
8263c408 908 48 0 0 0 0 mapped_file( win32k.sys )
8252dda8 0 324 0 0 0 0 mapped_file( ShellIconCache )
8272f638 128 112 0 116 0 0 mapped_file( advapi32.dll )
......
82755958 0 4 0 0 0 0 mapped_file( $Directory )
8250b518 0 4 0 0 0 0 No Name for File
8254d8d8 0 4 0 0 0 0 mapped_file( $Directory )
82537be8 0 4 0 0 0 0 mapped_file( Windows Explorer.lnk )
-------- 1348 0 0 ----- ----- 904 process ( System )
-------- 492 0 0 ----- ----- 72 process ( winmine.exe )
-------- 3364 1384 1396 ----- ----- 188 process ( explorer.exe )
-------- 972 0 0 ----- ----- 88 process ( services.exe )
-------- 496 1456 384 ----- ----- 164 process ( winmgmt.exe )
-------- 1144 0 0 ----- ----- 120 process ( svchost.exe )
-------- 944 0 0 ----- ----- 156 process ( winlogon.exe )
-------- 412 0 0 ----- ----- 64 process ( csrss.exe )
......
-------- 12 0 0 ----- ----- 8 process ( wmiadap.exe )
-------- 316 0 0 ----- ----- 0 pagefile section (346e)
-------- 4096 0 0 ----- ----- 0 pagefile section (9ad)
-------- 884 280 36 ----- 0 ----- driver ( ntoskrnl.exe )
-------- 88 8 0 ----- 0 ----- driver ( hal.dll )
-------- 8 0 0 ----- 0 ----- driver ( kdcom.dll )
-------- 12 0 0 ----- 0 ----- driver ( BOOTVID.dll )
......
-------- 8 0 0 ----- 0 ----- driver ( ndisuio.sys )
-------- 16 0 0 ----- 0 ----- driver ( dump_scsiport.sys )
-------- 56 0 0 ----- 0 ----- driver ( dump_aic78xx.sys )
-------- 2756 1060 876 ----- 0 ----- driver ( Paged Pool )
-------- 1936 128 148 ----- 0 ----- driver ( Kernel Stacks )
-------- 0 0 0 ----- 0 ----- driver ( NonPaged Pool )
第一列顯示用來描述每個已映射結構(mapped structure)的控制域結構(control area structure)地址。使用!ca 擴展命令可以顯示這些控制域。
註釋
使用 !vm 擴展命令可以分析虛擬內存使用。該命令一般比!memusage要更有用些。關於內存管理的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!pfn 擴展命令可以用來查看PFN數據庫中某個特定頁面幀。
!mps
!mps 擴展顯示目標機中Intel 多處理器規範(Multiprocessor Specification (MPS))的BIOS信息。
語法
!mps [Address]
參數
Address
指定BIOS中MPS表的16進制地址。如果省略,則從HAL中獲取該信息。這需要HAL的符號。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展命令僅對x86目標機使用。
附加信息
關於BIOS調試的更多信息,查看調試BIOS代碼。關於MPS的信息,查看Intel MultiProcessor Specification的適當版本。
!mtrr
!mtrr 擴展顯示MTRR寄存器的內容。
語法
!mtrr
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能用於x86目標機。
!npx
!npx 擴展顯示浮點寄存器保存區域(floating-point register save area)的內容。
語法
!npx Address
參數
Address
指定FLOATING_SAVE_AREA 結構的16進制地址。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能用於x86目標機。
!ob, !od, !ow
!ob、 !od、以及!ow 擴展命令已廢除。使用ob, od, ow (Output to Port) 命令來替代。
!object
!object 擴展顯示某個系統對象。
語法
Windows NT 4.0的語法
!object Address
!object 0 Name
!object \
Windows 2000和之後的語法
!object Address
!object 0 Name
!object Path
!object -r
參數
Address
如果第一個參數是非0的16進制數字,則指定要顯示信息的系統對象的16進制地址。
Name
如果第一個參數爲0,則第二個參數是要顯示所有實例的系統對象類型的名字。
Path
如果第一個參數以反斜線開頭 (\), !object 將它當作一個對象路徑的名字(object path name)。使用該選項時,會根據對象管理器(Object Manager)的目錄結構來進行顯示。
\
(僅Windows NT 4.0) 指定根目錄對象(root directory object)。
-r
(Windows 2000 和之後) 使得被緩存的全局變量的值被刷新。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
!object 擴展會緩存一些值能夠被改變的特定的全局變量。如果使用的內核符號已經過期,可以使用!object –r來刷新緩存的值。
下面的例子用!handle 擴展來獲得對象指針:
kd> !handle
processor number 0
PROCESS 80a02920 Cid: 0002 Peb: 00000000 ParentCid: 0000
DirBase: 0006c805 ObjectTable: 80a03788 TableSize: 54.
Image: System
006c: Object: 80967768 GrantedAccess: 00100003
Object: 80967768 Type: (809d5c20) File
ObjectHeader: 80967750
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \WINNT\system32\config\software {Partition1}
kd> !object 80967768
Object: 80967768 Type: (809d5c20) File
ObjectHeader: 80967750
HandleCount: 1 PointerCount: 1
Directory Object: 00000000 Name: \WINNT\system32\config\software {Partition1}
附加信息
關於對象和對象管理器的信息,查看Microsoft Windows SDK文檔、Windows Driver Kit (WDK)文檔、以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!obtrace
!obtrace 擴展顯示指定對象的對象引用數據。
語法
!obtrace Object
參數
Object
指向對象的指針或者路徑。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
Windows的對象引用跟蹤功能會在每次對象的引用計數增加或者減少時記錄調用堆棧。
使用該擴展命令來顯示對象引用跟蹤數據前,必須用GFlags來對指定的對象啓用對象引用跟蹤(object reference tracing) 。可以通過內核標誌(運行時)設置來啓用對象引用跟蹤,這種改變會立即生效,但是關閉或重起之後消失;也可以通過註冊表設置,這種設置需要重起,但是如果沒有改變的話會一直保持下去。
下面是!obtrace 擴展的輸出示例:
kd> !obtrace 0xfa96f700
Object: fa96f700 Image: cmd.exe
Sequence (+/-) Stack
-------- ----- ---------------------------------------------------
2421d +1 nt!ObCreateObject+180
nt!NtCreateEvent+92
nt!KiFastCallEntry+104
nt!ZwCreateEvent+11
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
2421e -1 nt!ObfDereferenceObject+19
nt!NtCreateEvent+d4
nt!KiFastCallEntry+104
nt!ZwCreateEvent+11
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
2421f +1 nt!ObReferenceObjectByHandle+1c3
win32k!xxxCreateThreadInfo+37d
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
24220 +1 nt!ObReferenceObjectByHandle+1c3
win32k!ProtectHandle+22
win32k!xxxCreateThreadInfo+3a0
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
24221 -1 nt!ObfDereferenceObject+19
win32k!xxxCreateThreadInfo+3a0
win32k!UserThreadCallout+6f
win32k!W32pThreadCallout+38
nt!PsConvertToGuiThread+174
nt!KiBBTUnexpectedRange+c
---- ----------------------------------------------------------
References: 3, Dereferences 2
!obtrace 0xfa96f700顯示出來的主要指示符在下表中列出。
參數 |
意義 |
Sequence |
表示操作的順序。 |
+/- |
表示引用或者取消引用的操作。 |
在x64目標機上的對象引用跟蹤可能不完全,因爲在IRQL高於PASSIVE_LEVEL 的時候並不一定能夠取到調用堆棧。
任何時候可以通過按下CTRL+BREAK (WinDbg) 或CTRL+C (KD)中止命令。
附加信息
關於全局標誌實用工具(GFlags)的更多信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!openmaps
!openmaps 擴展顯示指定的共享緩存映射(shared cache map)的引用緩衝區控制塊(referenced buffer control blocks (BCBs)),和虛擬地址控制塊(virtual address control blocks (VACBs))。
語法
!openmaps Address [Flag]
參數
Address
指定共享緩存映射的地址。
Flag
指定要顯示哪個控制塊。如果Flag爲1,調試器顯示所有控制塊。如果Flag爲0,調試器僅顯示引用控制塊 (referenced control blocks)。默認值爲0。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
附加信息
關於緩存管理的信息,查看Microsoft Windows SDK文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
關於其他緩存管理擴展命令的信息,查看!cchelp 擴展。
WinDbg 文檔翻譯----81
cc682/NetRoc
http://netroc682.spaces.live.com/
!job
!job 擴展用來顯示一個作業(job)對象。
語法
!job [Process [Flags]]
參數
Process
指定要查看的job對象所關聯的進程或者線程的16進制地址。如果省略或者設爲-1(Windows 2000中)或者0 (Windows XP和之後),則顯示當前進程關聯的job對象。
Flags
指定顯示中包含的內容。可以是任意下面這些位值的和。默認值爲0x1:
Bit 0 (0x1)
顯示job的設置和統計。
Bit 1 (0x2)
顯示job中所有進程的列表。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該擴展輸出的示例:
kd> !process 52c
Searching for Process with Cid == 52c
PROCESS 8276c550 SessionId: 0 Cid: 052c Peb: 7ffdf000 ParentCid: 0060
DirBase: 01289000 ObjectTable: 825f0368 TableSize: 24.
Image: cmd.exe
VadRoot 825609e8 Vads 30 Clone 0 Private 77. Modified 0. Locked 0.
DeviceMap e1733f38
Token e1681610
ElapsedTime 0:00:12.0949
UserTime 0:00:00.0359
.....
CommitCharge 109
Job 8256e1f0
kd> !job 8256e1f0
Job at ffffffff8256e1f0
TotalPageFaultCount 0
TotalProcesses 1
ActiveProcesses 1
TotalterminatedProcesses 0
LimitFlags 0
MinimumWorkingSetSize 0
MaximumWorkingSetSize 0
ActiveProcessLimit 0
PriorityClass 0
UIRestrictionsClass 0
SecurityLimitFlags 0
Token 00000000
附加信息
關於job對象的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!kb, !kv
!kb 和!kv 擴展命令已經廢除。使用kb (Display Stack Backtrace) 和kv (Display Stack Backtrace) 命令來替代。
!loadermemorylist
!loadermemorylist 擴展顯示Windows boot loader傳遞給Windows的內存分配列表。
語法
!loadermemorylist ListHeadAddress
參數
ListHeadAddress
指定列表頭的地址。
DLL
Windows NT 4.0 |
Kdexts.dll |
Windows 2000 |
Kdexts.dll |
Windows XP |
Kdexts.dll |
Windows Vista和之後 |
Kdexts.dll |
註釋
該擴展是設計在Ntldr正在運行的系統引導早期使用的。它會在內存分配列表中顯示開始位置、結束爲止和每個頁範圍的類型。
任何時候按下CTRL+BREAK (WinDbg) 或CTRL+C (KD)都可以中斷命令的執行。
!lockedpages
!lockedpages 擴展在Windows 2000中顯示當前進程的driver-locked page,在Windows XP和之後的系統中顯示指定進程的driver-locked page。
語法
Windows 2000的語法
!lockedpages
Windows XP和之後的語法
!lockedpages [Process]
參數
Process
(僅Windows XP和之後) 指定某個進程。如果省略Process,則使用當前進程。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
任何時候按下CTRL+BREAK (WinDbg) 或CTRL+C (KD)都可以中斷命令的執行。
!locks (!kdext*.locks)
Kdextx86.dll 和Kdexts.dll中的!locks 擴展命令顯示內核ERESOURCE 鎖的信息。
該命令不要和!ntsdexts.locks 擴展命令混淆。
語法
!locks [Options] [Address]
參數
Options
指定要顯示的信息數量。可以是下面這些選項的任意組合:
-v
顯示每個鎖的詳細信息。
-p
顯示鎖的所有可能的信息,包括性能統計。
-d
顯示所有鎖的信息。否則只顯示出現爭用的鎖。
Address
指定要顯示的ERESOURCE 鎖的16進制地址。如果Address爲0或者省略,則顯示系統中所有ERESOURCE 鎖。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
!locks 擴展顯示線程爲資源而持有的所有的鎖。鎖可以是共享的(shared)或者獨佔的(exclusive),獨佔意味着其它線程不能訪問該資源。當系統發生死鎖時這個信息很有用。死鎖是由於某個非執行的線程持有了某個資源的獨佔鎖,但是其它執行的線程又需要這個所的時候會發生。
在Microsoft Windows 2000中通常可以通過查找非執行線程持有了某個執行線程請求的某個資源的獨佔鎖的情況,來定位死鎖。大多數的鎖都是共享的。
下面是基本的!locks 輸出的示例:
kd> !locks
**** DUMP OF ALL RESOURCE OBJECTS ****
KD: Scanning for held locks......
Resource @ 0x80e97620 Shared 4 owning threads
Threads: ff688da0-01<*> ff687da0-01<*> ff686da0-01<*> ff685da0-01<*>
KD: Scanning for held locks.......................................................
Resource @ 0x80e23f38 Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
KD: Scanning for held locks.
Resource @ 0x80d8b0b0 Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
2263 total locks, 3 locks currently held
注意顯示出來的每個線程的地址後面都跟有線程計數 (例如"-01")。如果某個線程後跟有 I "<*>",則該線程是鎖的所有者。有些情況下,初始線程的地址會包含一個偏移。這種情況下,實際的線程地址也會顯示出來。
如果想查看這些資源對象中某一個的更多信息,可以將"Resource @"後的地址作爲其它命令的參數。要查看上面例子中的第二個資源,可以使用dt ERESOURCE 80d8b0b0 或者 !thread 80ed0020。或者也可以帶-v選項再次使用!locks:
kd> !locks -v 80d8b0b0
Resource @ 0x80d8b0b0 Shared 1 owning threads
Threads: 80ed0023-01<*> *** Actual Thread 80ed0020
THREAD 80ed0020 Cid 4.2c Teb: 00000000 Win32Thread: 00000000 WAIT: (WrQueue) KernelMode Non-Alertable
8055e100 Unknown
Not impersonating
GetUlongFromAddress: unable to read from 00000000
Owning Process 80ed5238
WaitTime (ticks) 44294977
Context Switch Count 147830
UserTime 0:00:00.0000
KernelTime 0:00:02.0143
Start Address nt!ExpWorkerThread (0x80506aa2)
Stack Init fafa4000 Current fafa3d18 Base fafa4000 Limit fafa1000 Call 0
Priority 13 BasePriority 13 PriorityDecrement 0
ChildEBP RetAddr
fafa3d30 804fe997 nt!KiSwapContext+0x25 (FPO: [EBP 0xfafa3d48] [0,0,4]) [D:\NT\base\ntos\ke\i386\ctxswap.asm @ 139]
fafa3d48 80506a17 nt!KiSwapThread+0x85 (FPO: [Non-Fpo]) (CONV: fastcall) [d:\nt\base\ntos\ke\thredsup.c @ 1960]
fafa3d78 80506b36 nt!KeRemoveQueue+0x24c (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ke\queueobj.c @ 542]
fafa3dac 805ad8bb nt!ExpWorkerThread+0xc6 (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ex\worker.c @ 1130]
fafa3ddc 8050ec72 nt!PspSystemThreadStartup+0x2e (FPO: [Non-Fpo]) (CONV: stdcall) [d:\nt\base\ntos\ps\create.c @ 2164]
00000000 00000000 nt!KiThreadStartup+0x16 [D:\NT\base\ntos\ke\i386\threadbg.asm @ 81]
1 total locks, 1 locks currently held
!logonsession
!logonsession 擴展顯示指定的登陸會話(logon session)的信息。
語法
Free Build 語法
!logonsession LUID
Checked Build語法
!logonsession LUID [InfoLevel]
參數
LUID
指定要顯示的登陸會話的局部唯一標識符(LUID)。 如果LUID爲0,則顯示所有登陸會話的信息。
要在check版中顯示系統會話和所有系統令牌(system token),輸入!logonsession 3e7 1。
InfoLevel
(僅Checked Build) 指定要顯示多少令牌信息(token information)。InfoLevel 參數可以是0到4之間的值,0表示最少的信息,4表示最多。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該擴展命令在free build上的輸出示例:
kd> !logonsession 0
Dumping all logon sessions.
** Session 0 = 0x0
LogonId = {0x0 0x0}
References = 0
** Session 1 = 0x8ebb50
LogonId = {0xe9f1 0x0}
References = 21
** Session 2 = 0x6e31e0
LogonId = {0x94d1 0x0}
References = 1
** Session 3 = 0x8ecd60
LogonId = {0x6b31 0x0}
References = 0
** Session 4 = 0xe0000106
LogonId = {0x0 0x0}
References = 0
** Session 5 = 0x0
LogonId = {0x0 0x0}
References = 0
** Session 6 = 0x8e9720
LogonId = {0x3e4 0x0}
References = 6
** Session 7 = 0xe0000106
LogonId = {0x0 0x0}
References = 0
** Session 8 = 0xa2e160
LogonId = {0x3e5 0x0}
References = 3
** Session 9 = 0xe0000106
LogonId = {0x0 0x0}
References = 0
** Session 10 = 0x3ca0
LogonId = {0x3e6 0x0}
References = 2
** Session 11 = 0xe0000106
LogonId = {0x0 0x0}
References = 0
** Session 12 = 0x1cd0
LogonId = {0x3e7 0x0}
References = 33
** Session 13 = 0xe0000106
LogonId = {0x0 0x0}
References = 0
14 sessions in the system.
任何時候都可以通過按下CTRL+BREAK (WinDbg) 或CTRL+C (KD)來中止命令執行。
附加信息
關於登陸會話的信息,查看Microsoft Windows SDK 文檔和Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!lookaside
!lookaside 擴展可以顯示look-aside lists的信息、重置look-aside list的計數器、或者改變look-aside list的深度。
語法
!lookaside [Address [Options [Depth]]]
參數
Address
指定要使用的look-aside lists的16進制地址。如果Address爲0或者省略,則顯示所有的系統look-aside list。
Options
控制要進行的操作。支持下面這些可能的Options 。默認值爲0:
0
顯示指定的look-aside list 的信息。 (如果Address爲0,則顯示所有系統look-aside list。)
1
重置指定look-aside list的計數器。(僅Windows NT 4.0:如果Address 爲0,則重置所有small pool look-aside list。)
2
改變指定look-aside list 的深度。該選項只有在Address 非0時可以使用。
Depth
設置給定的look-aside list的最大深度。該參數僅在Addres非0,並且Options 等於 2時可用。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
Look-aside list是一種用於管理固定大小的分頁或非分頁內存池的多處理器安全的機制。
由於在大多數平臺上都不使用自旋鎖(spin lock),所以look-aside list是高效的。
注意如果look-aside list的當前深度大於它的最大深度,則釋放關聯到該list的結構時會釋放到池內存中,而不是釋放到list內存中。
下面是該擴展的輸出示例:
kd> !lookaside e0000165f7621800
Lookaside "" @ e0000165f7621800 "Ntfs"
Type = 0011 PagedPool RaiseIfAllocationFailure
Current Depth = 0 Max Depth = 4
Size = 488 Max Alloc = 1952
AllocateMisses = 3 FreeMisses = 0
TotalAllocates = 4 TotalFrees = 4
Hit Rate = 25% Hit Rate = 100%
附加信息
關於look-aside list的信息,查看Windows Driver Kit (WDK) 文檔,以及 Mark Russinovich 和David Solomon編寫的Microsoft Windows Internals。
!lpc
!lpc 擴展顯示目標系統中的本地過程調用(local procedure call (LPC))端口和信息。
語法
Windows NT 4.0的語法
!lpc
Windows 2000的語法
!lpc message MessageID
!lpc port Port
!lpc scan Port
!lpc thread Thread
!lpc
Windows Server 2003 和Windows XP的語法
!lpc message MessageID
!lpc port Port
!lpc scan Port
!lpc thread Thread
!lpc PoolSearch
!lpc
參數
message
(僅Windows Server 2003、Windows XP、和Windows 2000) 如果有的話,顯示某條消息的信息,例如隊列中包含該消息的服務器端口(server port)、等待該消息的線程。
MessageID
(僅Windows Server 2003、Windows XP、和Windows 2000) 指定要顯示的消息的消息ID。如果該參數的值爲0或者省略,!lpc message 命令顯示消息的摘要列表。(在Windows 2000 Service Pack 1 (SP1)中,摘要包括LPC zone 的所有消息。在Windows 2000 Service Pack 2 (SP2)、 Windows XP和之後版本的Windows中,摘要包括系統池中的所有消息。已經被頁換出得消息不會包含。)
port
(僅Windows Server 2003、Windows XP、和Windows 2000) 顯示端口信息,如端口的名字、信號量狀態、隊列中的消息、裁剪隊列(rundown queue)中的線程、句柄數量、引用、以及相關的端口。
scan
(僅Windows Server 2003、Windows XP、和Windows 2000) 顯示指定端口以及連接到它的所有端口的摘要信息。
Port
(僅Windows Server 2003、Windows XP、和Windows 2000) 指定要顯示的端口的16進制地址。如果使用!lpc port 命令,並且 Port 爲0或省略,則顯示所由LPC端口的摘要列表。如果使用!lpc scan 命令,Port 必須指定一個實際的端口地址。
thread
(僅Windows Server 2003、Windows XP、和Windows 2000) 顯示在rundown port queue中包含指定線程的所有端口的信息。
Thread
(僅Windows Server 2003、Windows XP、和Windows 2000) 指定線程的16進制地址。如果爲0或者省略,!lpc thread命令顯示所有正在進行LPC操作的線程的摘要列表。
PoolSearch
(僅Windows Server 2003、Windows XP、和Windows 2000) 指定!lpc message命令是否在內核池(kernel pool)中搜索消息。每次使用!lpc PoolSearch時,該設置會在打開和關閉之間切換(初始設置是不搜索內核池)。它僅作用於MessageID指定爲非0值的!lpc message命令。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP |
Kdexts.dll |
註釋
該擴展在Windows Vista和之後版本的Windows中不支持。
在Windows NT 4.0,不帶參數使用 !lpc 會顯示目標機上所有LPC端口和消息,類似在Windows 2000和之後系統中使用!lpc port 然後使用 !lpc message。
在Windows Server 2003、Windows XP和Windows 2000中,不帶參數使用!lpc 會在調試器命令窗口中顯示該擴展命令的幫助文本。
如果有某個線程被標記爲在等待某條消息返回,可以使用!lpc message 命令和這條延遲的消息的ID。命令會顯示該消息、包含它的端口、以及所有被延遲的線程。
如果找不到消息,並且沒有讀取錯誤(例如"Unable to access zone segment"),則服務器已經接收到了這條消息。
這種情況下,服務器端口一般可以通過!lpc thread命令找到。等待響應的線程連接到服務器通信隊列(server communication queue)上。這條命令可以顯示所有包含指定線程的端口。知道了端口地址之後,可以使用!lpc port 命令。通過使用!lpc thread 命令和線程地址,可以獲得關於每條線程的更多信息。
下面是擴展命令在Windows XP系統上的輸出示例:
這個例子中,顯示了所有LPC端口。
kd> !lpc port
Scanning 225 objects
1 Port: 0xe1405650 Connection: 0xe1405650 Communication: 0x00000000 'SeRmCommandPort'
1 Port: 0xe141ef50 Connection: 0xe141ef50 Communication: 0x00000000 'SmApiPort'
1 Port: 0xe13c5740 Connection: 0xe13c5740 Communication: 0x00000000 'ApiPort'
1 Port: 0xe13d9550 Connection: 0xe13d9550 Communication: 0x00000000 'SbApiPort'
3 Port: 0xe13d8830 Connection: 0xe141ef50 Communication: 0xe13d8910 ''
80000004 Port: 0xe13d8910 Connection: 0xe141ef50 Communication: 0xe13d8830 ''
3 Port: 0xe13d8750 Connection: 0xe13d9550 Communication: 0xe13a4030 ''
.....
上面例子中,地址e14ae238 處的端口沒有消息,即所有消息都已經被接收並且沒有新消息到達。
kd> !lpc port e14ae238
Server connection port e14ae238 Name: ApiPort
Handles: 1 References: 107
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
The message queue is empty
The LpcDataInfoChainHead queue is empty
上面例子中,0xe14ae238 處的端口有已排隊但是還沒有被服務器接收的消息。
kd> !lpc port 0xe14ae238
Server connection port e14ae238 Name: ApiPort
Handles: 1 References: 108
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
Messages in queue:
0000 e20d9b80 - Busy Id=0002249c From: 0584.0680 Context=00000021 [e14ae248 . e14ae248]
Length=0098007c Type=00000001 (LPC_REQUEST)
Data: 00000000 0002021e 00000584 00000680 002f0001 00000007
The message queue contains 1 messages
The LpcDataInfoChainHead queue is empty
剩下的這些Windows XP上的示例是關於可以在這條擴展命令中使用的其它選項的。
kd> !lpc message 222be
Searching message 222be in threads ...
Client thread 842a4db0 waiting a reply from 222be
Searching thread 842a4db0 in port rundown queues ...
Server communication port 0xe114a3c0
Handles: 1 References: 1
The LpcDataInfoChainHead queue is empty
Connected port: 0xe1e7b948 Server connection port: 0xe14ae238
Client communication port 0xe1e7b948
Handles: 1 References: 3
The LpcDataInfoChainHead queue is empty
Server connection port e14ae238 Name: ApiPort
Handles: 1 References: 107
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
The message queue is empty
The LpcDataInfoChainHead queue is empty
Done.
kd> !lpc thread 842a4db0
Searching thread 842a4db0 in port rundown queues ...
Server communication port 0xe114a3c0
Handles: 1 References: 1
The LpcDataInfoChainHead queue is empty
Connected port: 0xe1e7b948 Server connection port: 0xe14ae238
Client communication port 0xe1e7b948
Handles: 1 References: 3
The LpcDataInfoChainHead queue is empty
Server connection port e14ae238 Name: ApiPort
Handles: 1 References: 107
Server process : 84aa0140 (csrss.exe)
Queue semaphore : 84a96da8
Semaphore state 0 (0x0)
The message queue is empty
The LpcDataInfoChainHead queue is empty
kd> !lpc scan e13d8830
Scanning 225 objects
3 Port: 0xe13d8830 Connection: 0xe141ef50 Communication: 0xe13d8910 ''
80000004 Port: 0xe13d8910 Connection: 0xe141ef50 Communication: 0xe13d8830 ''
Scanning 3 objects
下面是在Windows NT 4.0系統上的輸出示例:
kd> !lpc
Scanning 2 objects of type 'Port'
Connection Port Object at e11b8bc0 - Name='\SmApiPort' created by smss.exe
Connection Port Object at e11ba040 - Name='\SeRmCommandPort' created by System
附加信息
關於LPC的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
WinDbg 文檔翻譯----80
cc682/NetRoc
http://netroc682.spaces.live.com/
!iovirp
!iovirp 擴展顯示指定的I/O Verifier IRP 的詳細信息。
語法
!iovirp [IRP]
參數
IRP
指定被驅動程序驗證器(Driver Verifier)跟蹤的IRP的地址。如果IRP 爲0或省略,則顯示每個未完成IRP的摘要信息。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該擴展輸出的示例:
kd> !iovirp 947cef68
IovPacket 84509af0
TrackedIrp 947cef68
HeaderLock 84509d61
LockIrql 0
ReferenceCount 1
PointerCount 1
HeaderFlags 00000000
ChainHead 84509af0
Flags 00200009
DepartureIrql 0
ArrivalIrql 0
StackCount 1
QuotaCharge 00000000
QuotaProcess 0
RealIrpCompletionRoutine 0
RealIrpControl 0
RealIrpContext 0
TopStackLocation 2
PriorityBoost 0
LastLocation 0
RefTrackingCount 0
SystemDestVA 0
VerifierSettings 84509d08
pIovSessionData 84509380
Allocation Stack:
nt!IovAllocateIrp+1a (817df356)
nt!IopXxxControlFile+40c (8162de20)
nt!NtDeviceIoControlFile+2a (81633090)
nt!KiFastCallEntry+164 (81513c64)
nt!EtwpFlushBuffer+10f (817606d7)
nt!EtwpFlushBuffersWithMarker+bd (817608cb)
nt!EtwpFlushActiveBuffers+2b4 (81760bc2)
nt!EtwpLogger+213 (8176036f)
任何時候通過按下CTRL+BREAK (WinDbg) 或者CTRL+C (KD)都可以中止命令。
!ipi
!ipi 擴展顯示指定處理器的跨處理器中斷(interprocessor interrupt (IPI))狀態。
語法
!ipi [Processor]
參數
Processor
指定一個處理器。如果省略Processor,則顯示所有處理器的 IPI 狀態。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該擴展只能對x86目標機使用。
註釋
下面是命令輸出的示例:
0: kd> !ipi
IPI State for Processor 0
Worker Routine: nt!KiFlushTargetMultipleTb [Stale]
Parameter[0]: 0
Parameter[1]: 3
Parameter[2]: F7C98770
Ipi Trap Frame: F7CCCCDC [.trap F7CCCCDC]
Signal Done: 0
IPI Frozen: 24 [FreezeActive] [Owner]
Request Summary: 0
Target Set: 0
Packet Barrier: 0
IPI State for Processor 1
Worker Routine: nt!KiFlushTargetMultipleTb [Stale]
Parameter[0]: 1
Parameter[1]: 3
Parameter[2]: F7CDCD28
Ipi Trap Frame: F7C8CCC4 [.trap F7C8CCC4]
Signal Done: 0
IPI Frozen: 2 [Frozen]
Request Summary: 0
Target Set: 0
Packet Barrier: 0
附加信息
關於IPI的信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!irp
!irp 擴展顯示某個I/O請求包(IRP)的信息。
語法
!irp Address [Detail]
參數
Address
指定IRP的16進制地址。
Detail
如果該參數包含了任何值,例如1,則輸出重包含IRP的狀態、內存描述符表(memory descriptor list (MDL))的地址、擁有者線程、它的所有I/O棧的堆棧信息、以及每個IRP堆棧位置的信息,包括主功能代碼(major function code)和次功能代碼(minor function code)的16進制數值。如果省略該參數,則只顯示摘要信息。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面這些信息有助於理解該擴展命令輸出的內容。
IRP 主功能代碼有下面這些:
Major Function Code |
16進制代碼 |
IRP_MJ_Create |
0x00 |
IRP_MJ_Create_NAMED_PIPE |
0x01 |
IRP_MJ_CLOSE |
0x02 |
IRP_MJ_READ |
0x03 |
IRP_MJ_WRITE |
0x04 |
IRP_MJ_QUERY_INFORMATION |
0x05 |
IRP_MJ_SET_INFORMATION |
0x06 |
IRP_MJ_QUERY_EA |
0x07 |
IRP_MJ_SET_EA |
0x08 |
IRP_MJ_FLUSH_BUFFERS |
0x09 |
IRP_MJ_QUERY_VOLUME_INFORMATION |
0x0A |
IRP_MJ_SET_VOLUME_INFORMATION |
0x0B |
IRP_MJ_DIRECTORY_CONTROL |
0x0C |
IRP_MJ_FILE_SYSTEM_CONTROL |
0x0D |
IRP_MJ_DEVICE_CONTROL |
0x0E |
IRP_MJ_INTERNAL_DEVICE_CONTROL |
0x0F |
IRP_MJ_SHUTDOWN |
0x10 |
IRP_MJ_LOCK_CONTROL |
0x11 |
IRP_MJ_CLEANUP |
0x12 |
IRP_MJ_Create_MAILSLOT |
0x13 |
IRP_MJ_QUERY_SECURITY |
0x14 |
IRP_MJ_SET_SECURITY |
0x15 |
IRP_MJ_POWER |
0x16 |
IRP_MJ_SYSTEM_CONTROL |
0x17 |
IRP_MJ_DEVICE_CHANGE |
0x18 |
IRP_MJ_QUERY_QUOTA |
0x19 |
IRP_MJ_SET_QUOTA |
0x1A |
IRP_MJ_PNP |
0x1B |
即插即用(Plug and Play) 次功能代碼有下面這些:
Minor Function Code |
16進制代碼 |
IRP_MN_START_DEVICE |
0x00 |
IRP_MN_QUERY_REMOVE_DEVICE |
0x01 |
IRP_MN_REMOVE_DEVICE |
0x02 |
IRP_MN_CANCEL_REMOVE_DEVICE |
0x03 |
IRP_MN_STOP_DEVICE |
0x04 |
IRP_MN_QUERY_STOP_DEVICE |
0x05 |
IRP_MN_CANCEL_STOP_DEVICE |
0x06 |
IRP_MN_QUERY_DEVICE_RELATIONS |
0x07 |
IRP_MN_QUERY_INTERFACE |
0x08 |
IRP_MN_QUERY_CAPABILITIES |
0x09 |
IRP_MN_QUERY_RESOURCES |
0x0A |
IRP_MN_QUERY_RESOURCE_REQUIREMENTS |
0x0B |
IRP_MN_QUERY_DEVICE_TEXT |
0x0C |
IRP_MN_FILTER_RESOURCE_REQUIREMENTS |
0x0D |
IRP_MN_READ_CONFIG |
0x0F |
IRP_MN_WRITE_CONFIG |
0x10 |
IRP_MN_EJECT |
0x11 |
IRP_MN_SET_LOCK |
0x12 |
IRP_MN_QUERY_ID |
0x13 |
IRP_MN_QUERY_PNP_DEVICE_STATE |
0x14 |
IRP_MN_QUERY_BUS_INFORMATION |
0x15 |
IRP_MN_DEVICE_USAGE_NOTIFICATION |
0x16 |
IRP_MN_SURPRISE_REMOVAL |
0x17 |
IRP_MN_QUERY_LEGACY_BUS_INFORMATION |
0x18 |
WMI次功能代碼有:
Minor Function Code |
16進制代碼 |
IRP_MN_QUERY_ALL_DATA |
0x00 |
IRP_MN_QUERY_SINGLE_INSTANCE |
0x01 |
IRP_MN_CHANGE_SINGLE_INSTANCE |
0x02 |
IRP_MN_CHANGE_SINGLE_ITEM |
0x03 |
IRP_MN_ENABLE_EVENTS |
0x04 |
IRP_MN_DISABLE_EVENTS |
0x05 |
IRP_MN_ENABLE_COLLECTION |
0x06 |
IRP_MN_DISABLE_COLLECTION |
0x07 |
IRP_MN_REGINFO |
0x08 |
IRP_MN_EXECUTE_METHOD |
0x09 |
電源管理的次功能代碼有:
Minor Function Code |
16進制代碼 |
IRP_MN_WAIT_WAKE |
0x00 |
IRP_MN_POWER_SEQUENCE |
0x01 |
IRP_MN_SET_POWER |
0x02 |
IRP_MN_QUERY_POWER |
0x03 |
SCSI 次功能代碼有:
Minor Function Code |
16進制代碼 |
IRP_MN_SCSI_CLASS |
0x01 |
輸出中還指出了當每個stack location當IRP完成或者stack location被處理時,在什麼情況下完成例程會被調用。有三種可能的情況:
Success
表示當IRP以成功代碼完成時完成例程會被調用。
Error
表示當IRP以錯誤代碼完成時,完成例程會被調用 。
Cancel
表示當嘗試cancel該IRP時完成里程會被調用。
可能會出現上面三個的任何組合形式,只要滿足其中一種條件,那麼完成例程都會被調用。適當的值會在每個stack location信息的第一行末尾列出,緊跟Completion-Context 之後。
下面是該擴展命令在Windows XP上的輸出示例:
!irp 81183468
Irp is active with 2 stacks 2 is current (= 0x811834fc)
No Mdl Thread 00000000: Irp stack trace.
Cmd flg cl Device File Completion-Context
[ 0, 0] 0 0 8145f470 00000000 00000000-00000000
\Driver\E100B
Args: 00000000 00000000 00000000 00000000
[ 16, 2] 0 e1 8145f470 00000000 8047f744-814187a8 Success Error Cancel pending
\Driver\E100B ntoskrnl!PopCompleteSystemPowerIrp
Args: 00000000 00000000 00000002 00000002
在Windows XP示例的第二個stack location處, 主功能代碼 是16,說明該IRP是發送給power stack的。次功能代碼是2,所以power stack 知道它是一個set 請求。該IRP被pending,並且當它完成時,不管指定的返回值是Success還是Error,ntoskrnl!PopCompleteSystemPowerIrp 都會被調用。
下面是該擴展命令在Windows Vista上的輸出示例:
0: kd> !irp 0x831f4a00
Irp is active with 8 stacks 5 is current (= 0x831f4b00)
Mdl = 82b020d8 Thread 8c622118: Irp stack trace.
cmd flg cl Device File Completion-Context
[ 0, 0] 0 0 00000000 00000000 00000000-00000000
Args: 00000000 00000000 00000000 00000000
[ 0, 0] 0 0 00000000 00000000 00000000-00000000
Args: 00000000 00000000 00000000 00000000
[ 0, 0] 0 0 00000000 00000000 00000000-00000000
Args: 00000000 00000000 00000000 00000000
[ 0, 0] 0 0 00000000 00000000 00000000-00000000
Args: 00000000 00000000 00000000 00000000
>[ 3,34] 40 e1 828517a8 00000000 842511e0-00000000 Success Error Cancel pending
\Driver\disk partmgr!PmReadWriteCompletion
Args: 00007000 00000000 fe084e00 00000004
[ 3, 0] 40 e0 82851450 00000000 842414d4-82956350 Success Error Cancel
\Driver\PartMgr volmgr!VmpReadWriteCompletionRoutine
Args: 129131bb 000000de fe084e00 00000004
[ 3, 0] 0 e0 82956298 00000000 847eeed0-829e2ba8 Success Error Cancel
\Driver\volmgr Ntfs!NtfsMasterIrpSyncCompletionRoutine
Args: 00007000 00000000 1bdae400 00000000
[ 3, 0] 0 0 82ac2020 8e879410 00000000-00000000
\FileSystem\Ntfs
Args: 00007000 00000000 00018400 00000000
注意驅動名邊上的完成例程是設置在該stack location上的,並且它是被下一行的驅動設置的。上面的例子中, Ntfs!NtfsMasterIrpSyncCompletionRoutine 是由\FileSystem\Ntfs設置的。 Ntfs!NtfsMasterIrpSyncCompletionRoutine上面的Completion-Context爲 847eeed0-829e2ba8,指示了該完成例程的地址以及將會傳遞給Ntfs!NtfsMasterIrpSyncCompletionRoutine的context。從這裏我們可以知道Ntfs!NtfsMasterIrpSyncCompletionRoutine 的地址是847eeed0,將會被傳遞給它的context爲 829e2ba8。
附加信息
查看Plug and Play 調試以及調試Interrupt Storms獲得該擴展命令的應用。關於IRP的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。關於主功能代碼和次功能代碼的更多信息,查看Windows Driver Kit (WDK)文檔。
!irpfind
!irpfind 顯示當前目標系統中已分配的,或者符合指定搜索條件的I/O請求包(IRP)的信息。
語法
Windows NT 4.0的語法
!irpfind [PoolType]
Windows 2000的語法
!irpfind [PoolType [RestartAddress [Criteria Data]]]
Windows XP and later的語法
!irpfind [-v] [PoolType [RestartAddress [Criteria Data]]]
參數
-v
(Windows XP和之後) 顯示詳細信息。
PoolType
指定要搜索的池的類型。可以指定下面這些值:
0
指定非分頁內存池(nonpaged memory pool)。這是默認值。
1
指定分頁內存池(paged memory pool)。
2
指定特殊池(special pool)。
4
(Windows XP和之後) 指定會話池(session pool)。
4, 5, 6
(僅Windows NT 4.0) 和0, 1, 2一樣,但是顯示詳細信息。
RestartAddress
指定搜索開始位置的16進制地址。這在前面的搜索提前終止時游泳。默認值爲0。
Criteria
指定搜索條件。只有滿足給定條件的IRP纔會顯示出來。
條件 |
匹配 |
arg |
查找所有某個stack location具有等於Data的參數的IRP。 |
device |
查找某個stack location的DeviceObject等於Data 的所有IRP。 |
fileobject |
查找Irp.Tail.Overlay.OriginalFileObject 等於Data的IRP。 |
mdlprocess |
查找Irp.MdlAddress.Process 等於Data的IRP。 |
thread |
查找Irp.Tail.Overlay.Thread 等於Data的IRP。 |
userevent |
查找 Irp.UserEvent 等於Data的IRP。 |
Data
指定搜索的匹配項。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面的例子查找完成時會設置FF9E4F48 用戶事件的,在非分頁池中的IRP:
kd> !irpfind 0 0 userevent ff9e4f48
下面的命令列出所有非分頁池中的IRP:
kd> !irpfind
Searching NonPaged pool (8090c000 : 8131e000) for Tag: Irp
8097c008 Thread 8094d900 current stack belongs to \Driver\symc810
8097dec8 Thread 8094dda0 current stack belongs to \FileSystem\Ntfs
809861a8 Thread 8094dda0 current stack belongs to \Driver\symc810
809864e8 Thread 80951ba0 current stack belongs to \Driver\Mouclass
80986608 Thread 80951ba0 current stack belongs to \Driver\Kbdclass
80986728 Thread 8094dda0 current stack belongs to \Driver\symc810
附加信息
查看Plug and Play 調試獲取該擴展命令的應用。關於IRP的更多信息,查看Windows Driver Kit (WDK)文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!irpzone
!irpzone 擴展命令已經廢除,使用 !irpfind 來替代。
!irql
!irql 擴展顯示目標機在調試器中斷之前某個處理器的中斷請求級別(interrupt request level (IRQL))。
語法
!irql [Processor]
參數
Processor
指定處理器。輸入處理器號。如果省略該參數,調試器顯示當前處理器的IRQL。
DLL
!irql 擴展僅在Windows Server 2003和之後的Windows版本中可用。
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP |
不可用 |
Windows Server 2003和之後 |
Kdexts.dll |
註釋
當目標機中斷到調試器時IRQL會改變,但是調試器中斷之前的IRQL會被保存下來。!irql 擴展會顯示這個被保存的 IRQL。
類似的,當發生bug check並且創建dump文件時,dump文件中會保存bug check之前的IRQL,而不是KeBugCheckEx 例程執行時的。
兩種情況下,除了x86架構上之外,當前IRQL都會被提升到DISPATCH_LEVEL。因此,如果不止一個這樣的事件發生,那麼顯示出來的IRQL會是DISPATCH_LEVEL,這樣對調試問題就沒有用處了。
!pcr 擴展命令可以在所有Windows版本上顯示當前IRQL,但是當前IRQL一般都是無用的。Bug check或者調試器連接之前的IRQL要更加有用一點,而它只能用!irql顯示出來。
如果指定了非法的處理器號,或者內核被破壞了,調試器會顯示"Cannot get PRCB address"的信息。
下面是該擴展在一個雙處理器的x86計算機上的輸出示例:
kd> !irql 0
Debugger saved IRQL for processor 0x0 -- 28 (CLOCK2_LEVEL)
kd> !irql 1
Debugger saved IRQL for processor 0x1 -- 0 (LOW_LEVEL)
如果調試器在詳細模式(verbose mode)下,則還會顯示IRQL本身的說明。下面是一個在Itanium處理器上的示例 :
kd> !irql
Debugger saved IRQL for processor 0x0 -- 12 (PC_LEVEL) [Performance counter level]
IRQL數字的意義通常由處理器決定。這裏是一個x64 處理器的例子。注意IRQL數字和上面的例子一樣,但是該IRQL的含義是不同的:
kd> !irql
Debugger saved IRQL for processor 0x0 -- 12 (SYNCH_LEVEL) [Synchronization level]
附加信息
關於IRQL的信息,查看Windows Driver Kit (WDK)文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!isainfo
!isainfo 顯示PNPISA卡或者系統中存在的設備的信息。
語法
!isainfo [Card]
參數
Card
指定一個PNPISA卡。如果 Card爲0或者省略,則顯示PNPISA (即PC I/O)總線上所有設備和卡。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該擴展輸出的示例:
0: kd> !isainfo
ISA PnP FDO @ 0x867b9938, DevExt @ 0x867b99f0, Bus # 0
Flags (0x80000000) DF_BUS
ISA PnP PDO @ 0x867B9818, DevExt @ 0x86595388
Flags (0x40000818) DF_ENUMERATED, DF_ACTIVATED,
DF_REQ_TRIMMED, DF_READ_DATA_PORT
!isr
!isr 擴展顯示指定地址處的Itanium中斷狀態寄存器(Interruption Status Register (ISR))。
語法
!isr Expression [DisplayLevel]
參數
Expression
指定要顯示的ISR寄存器的16進制地址。也可以使用@isr表達式作爲該參數。這種情況下,顯示當前處理器的ISR寄存器信息。
DisplayLevel
可以是下面這些選項之一:
0
僅顯示每個ISR字段的值。這是默認值。
1
顯示非保留和非忽略的ISR字段的詳細信息。
2
顯示ISR的所有字段,包括被忽略或被保留的那些。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能對Itanium目標機使用。
註釋
下面是命令輸出的示例:
kd> !isr @isr
isr:ed ei so ni ir rs sp na r w x vector code
0 0 0 0 0 0 0 0 0 0 0 0 0
kd> !isr @isr 2
cod : 0 : interruption Code
vec : 0 : IA32 exception vector number
rv : 0 : reserved0
x : 0 : eXecute exception
w : 0 : Write exception
r : 0 : Read exception
na : 0 : Non-Access exception
sp : 0 : Speculative load exception
rs : 0 : Register Stack
ir : 0 : Invalid Register frame
ni : 0 : Nested Interruption
so : 0 : IA32 Supervisor Override
ei : 0 : Exception IA64 Instruction
ed : 0 : Exception Deferral
rv : 0 : reserved1
!ivt
!ivt 擴展顯示Itanium中斷向量表(interrupt vector table)。
語法
!ivt [-v] [-a] [Vector]
!ivt -?
參數
Vector
指定當前處理器的中斷向量表條目。如果省略Vector,則顯示目標機當前處理器的整個中斷向量表。如果沒有使用-a選項,那麼未賦值的中斷向量不會顯示出來。
-a
顯示所有中斷向量,包括未賦值的那些。
-v
顯示詳細輸出。
-?
在調試器命令窗口中顯示幫助文本。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能在Itanium目標機上使用。
註釋
下面是命令輸出的示例:
kd> !ivt
Dumping IA64 IVT:
00:e000000083005f60 nt!KiPassiveRelease
0f:e000000083576830 hal!HalpPCIISALine2Pin
10:e0000000830067f0 nt!KiApcInterrupt
20:e000000083006790 nt!KiDispatchInterrupt
30:e000000083576b30 hal!HalpCMCIHandler
31:e000000083576b20 hal!HalpCPEIHandler
41:e000000085039680 i8042prt!I8042KeyboardInterruptService (KINTERRUPT e000000085039620)
51:e000000085039910 i8042prt!I8042MouseInterruptService (KINTERRUPT e0000000850398b0)
61:e0000000854484f0 VIDEOPRT!pVideoPortInterrupt (KINTERRUPT e000000085448490)
71:e0000000856c9450 NDIS!ndisMIsr (KINTERRUPT e0000000856c93f0)
81:e0000000857fd000 SCSIPORT!ScsiPortInterrupt (KINTERRUPT e0000000857fcfa0)
91:e0000000857ff510 atapi!IdePortInterrupt (KINTERRUPT e0000000857ff4b0)
a1:e0000000857d84b0 atapi!IdePortInterrupt (KINTERRUPT e0000000857d8450)
a2:e0000165fff2cab0 portcls!CInterruptSyncServiceRoutine (KINTERRUPT e0000165fff2ca50)
b1:e0000000858c7460 ACPI!ACPIInterruptServiceRoutine (KINTERRUPT e0000000858c7400)
b2:e0000000850382e0 USBPORT!USBPORT_InterruptService (KINTERRUPT e000000085038280)
d0:e0000000835768d0 hal!HalpClockInterrupt
e0:e000000083576850 hal!HalpIpiInterruptHandler
f0:e0000000835769c0 hal!HalpProfileInterrupt
f1:e000000083576830 hal!HalpPCIISALine2Pin
fd:e000000083576b10 hal!HalpMcRzHandler
fe:e000000083576830 hal!HalpPCIISALine2Pin
附加信息
關於如何顯示x64和x86目標機上的中斷分配表(interrupt dispatch table) ,查看!idt。
WinDbg 文檔翻譯----79
cc682/NetRoc
http://netroc682.spaces.live.com/
!gbl
!gbl 擴展顯示目標機的ACPI BIOS 根系統描述表(ACPI BIOS Root System Description (RSDT) table)的頭信息。
語法
!gbl [-v]
參數
-v
詳細輸出。顯示錶中的詳細信息。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
附加信息
關於ACPI和ACPI表的更多信息,查看其他ACPI調試擴展以及 ACPI Specification站點。也可以查看Microsoft Windows SDK文檔、Windows Driver Kit (WDK)文檔、以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!gentable
!gentable 擴展顯示某個RTL_GENERIC_TABLE 。
語法
Windows 2000中的語法
!gentable Address
Windows XP和之後的語法
!gentable Address [Flag]
參數
Address
指定RTL_GENERIC_TABLE的地址。
Flag
(Windows XP 和之後) 指定表的來源。如果Flag 是1,則使用AVL表,如果Flag 爲0或者省略,則使用non-AVL 表。在Windows 2000中,總是使用non-AVL表。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
!hidppd
!hidppd 擴展顯示HIDP_PREPARSED_DATA 結構的內容。
語法
!hidppd Address
參數
Address
指定HIDP_PREPARSED_DATA 結構的16進制地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
附加信息
關於human input devices (HID)的信息,查看Windows Driver Kit (WDK) 文檔。
!ib, !id, !iw
!ib、 !id、和 !iw 命令已經廢除。使用ib, id, iw (Input from Port)命令替代。
!icpleak
!icpleak 擴展在系統中查找隊列中條目個數最大的I/O completion對象。
語法
!icpleak [HandleFlag]
參數
HandleFlag
如果設置了該標誌,則還會顯示擁有該最大的隊列條目個數的對象句柄的所有進程。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
註釋
該擴展在I/O completion池存在泄漏的情況下很有用。I/O completion pool 泄露在進程調用PostQueuedCompletionStatus 分配I/O completion packet,但是又沒有調用GetQueuedCompletionStatus 來釋放,或者進程將completion entries排隊到某個端口,但是又沒有任何線程會取出這些entries時就會發生。通過運行!poolused 擴展並且檢查ICP pool tag的值來發現泄露。如果有使用ICP tag的池(pool),那麼就可能發生了泄露。
該擴展只有在系統維護了類型列表(type lists)時才能工作。如果設置了HandleFlag並且系統中有很多進程,則可能需要運行很長時間。
可以按下CTRL+BREAK (WinDbg中) 或者CTRL+C (KD中)來中止命令。
附加信息
關於I/O完成端口( I/O completion port)的信息,查看Mark Russinovich 和David Solomon編寫的 Microsoft Windows Internals。
!idt
!idt 擴展顯示指定的中斷分配表(interrupt dispatch table (IDT))中的中斷服務例程(interrupt service routine (ISR))。
語法
!idt IDT
!idt [-a]
!idt -?
參數
IDT
指定要顯示的IDT。
-a
沒有指定IDT 時,會以簡短的格式顯示目標機上所有處理器的IDT。如果指定了-a ,則顯示所有IDT的ISR。
-?
在調試器命令窗口中顯示該命令的幫助文本。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該擴展命令只能對x64或者x86目標機使用。
註釋
下面是該擴展命令的示例:
0: kd> !idt
Dumping IDT:
37:806ba78c hal!PicSpuriousService37
3d:806bbc90 hal!HalpApcInterrupt
41:806bbb04 hal!HalpDispatchInterrupt
50:806ba864 hal!HalpApicRebootService
63:8641376c VIDEOPRT!pVideoPortInterrupt (KINTERRUPT 86413730)
73:862aa044 portcls!CInterruptSyncServiceRoutine (KINTERRUPT 862aa008)
82:86594314 atapi!IdePortInterrupt (KINTERRUPT 865942d8)
83:86591bec SCSIPORT!ScsiPortInterrupt (KINTERRUPT 86591bb0)
92:862b53dc serial!SerialCIsrSw (KINTERRUPT 862b53a0)
93:86435844 i8042prt!I8042KeyboardInterruptService (KINTERRUPT 86435808)
a3:863b366c i8042prt!I8042MouseInterruptService (KINTERRUPT 863b3630)
a4:8636bbec USBPORT!USBPORT_InterruptService (KINTERRUPT 8636bbb0)
b1:86585bec ACPI!ACPIInterruptServiceRoutine (KINTERRUPT 86585bb0)
b2:863c0524 serial!SerialCIsrSw (KINTERRUPT 863c04e8)
b4:86391a54 NDIS!ndisMIsr (KINTERRUPT 86391a18)
USBPORT!USBPORT_InterruptService (KINTERRUPT 863ae890)
c1:806ba9d0 hal!HalpBroadcastCallService
d1:806b9dd4 hal!HalpClockInterrupt
e1:806baf30 hal!HalpIpiHandler
e3:806baca8 hal!HalpLocalApicErrorService
fd:806bb460 hal!HalpProfileInterrupt
附加信息
關於ISR和IDT的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
關於如何顯示Itanium目標機上的中斷向量表(interrupt vector table),查看!ivt。
!ih
!ih 顯示指定處理器上的中斷歷史紀錄。
語法
!ih Processor
參數
Processor
指定某個處理器。如果省略Processor ,則使用當前處理器。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該命令只能對Itanium目標機使用。
註釋
該擴展在不涉及程序計數器符號(program counter symbols)的情況下顯示中斷歷史紀錄。要使用程序計數器符號來顯示中斷歷史紀錄,使用!ihs擴展。在引導入口選項中添加/configflag=32來啓用中斷歷史紀錄。
下面是該命令輸出的示例:
kd> !ih
Total # of interruptions = 2093185
Vector IIP IPSR ExtraField
VHPT FAULT e0000000830d3190 1010092a6018 IFA= 6fc00a0200c
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe00001de2d0
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe01befff338
VHPT FAULT e0000000830d3190 1010092a6018 IFA= 6fc00a0200c
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe00001d9188
VHPT FAULT e0000000830d3880 1010092a6018 IFA= 1ffffe01befff250
VHPT FAULT e0000000830d3fb0 1010092a6018 IFA= e0000165f82dc1c0
VHPT FAULT e000000083063390 1010092a6018 IFA= e0000000fffe0018
THREAD SWITCH e000000085896040 e00000008588c040 OSP= e0000165f82dbd40
VHPT FAULT e00000008329b130 1210092a6018 IFA= e0000165f7edaf30
VHPT FAULT e0000165f7eda640 1210092a6018 IFA= e0000165fff968a9
PROCESS SWITCH e0000000818bbe10 e000000085896040 OSP= e0000165f8281de0
VHPT FAULT e00000008307cfc0 1010092a2018 IFA= e00000008189fe50
EXTERNAL INTERRUPT e0000000830623b0 1010092a6018 IVR= d0
VHPT FAULT e00000008314e310 1010092a2018 IFA= e0000165f88203f0
VHPT FAULT e000000083580760 1010092a2018 IFA= e0000000f00ff3fd
PROCESS SWITCH e00000008558c990 e0000000818bbe10 OSP= e00000008189fe20
VHPT FAULT e00000008307cfc0 1010092a2018 IFA= e0000165f02433f0
VHPT FAULT 77cfbda0 1013082a6018 IFA= 77cfbda0
VHPT FAULT 77cfbdb0 1213082a6018 IFA= 6fbfee0ff98
DATA ACCESS BIT 77b8e150 1213082a6018 IFA= 77c16ab8
VHPT FAULT 77ed5d60 1013082a6018 IFA= 6fbfffa6048
DATA ACCESS BIT 77ed5d60 1213082a6018 IFA= 77c229c0
DATA ACCESS BIT 77b8e1b0 1013082a6018 IFA= 77c1c320
USER SYSCALL 77cafa40 10082a6018 Num= 42
VHPT FAULT e00000008344dc20 1010092a6018 IFA= e000010600703784
...
!ihs
!ihs 擴展使用程序計數器符號(program counter symbols)來顯示指定處理器的中斷歷史紀錄。
語法
!ihs Processor
參數
Processor
指定某個處理器。如果省略Processor ,則使用當前處理器。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kdexts.dll |
該命令只能對Itanium目標機使用。
註釋
使用!ih 擴展在不引用程序計數器符號的情況下顯示中斷歷史紀錄。在引導入口選項中添加/configflag=32來啓用中斷歷史紀錄。
下面是該擴展命令的輸出示例:
kd> !ihs
Total # of interruptions = 2093185
Vector IIP IPSR ExtraField IIP Symbol
VHPT FAULT e0000000830d3190 1010092a6018 IFA= 6fc00a0200c nt!MiAgeAndEstimateAvailableInWorkingSet+0x70
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe00001de2d0 nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe01befff338 nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
VHPT FAULT e0000000830d3190 1010092a6018 IFA= 6fc00a0200c nt!MiAgeAndEstimateAvailableInWorkingSet+0x70
VHPT FAULT e0000000830d33d0 1010092a6018 IFA= 1ffffe00001d9188 nt!MiAgeAndEstimateAvailableInWorkingSet+0x2b0
VHPT FAULT e0000000830d3880 1010092a6018 IFA= 1ffffe01befff250 nt!MiAgeAndEstimateAvailableInWorkingSet+0x760
VHPT FAULT e0000000830d3fb0 1010092a6018 IFA= e0000165f82dc1c0 nt!MiCheckAndSetSystemTrimCriteria+0x190
VHPT FAULT e000000083063390 1010092a6018 IFA= e0000000fffe0018 nt!KeQuerySystemTime+0x30
THREAD SWITCH e000000085896040 e00000008588c040 OSP= e0000165f82dbd40
VHPT FAULT e00000008329b130 1210092a6018 IFA= e0000165f7edaf30 nt!IopProcessWorkItem+0x30
VHPT FAULT e0000165f7eda640 1210092a6018 IFA= e0000165fff968a9 netbios!RunTimerForLana+0x60
PROCESS SWITCH e0000000818bbe10 e000000085896040 OSP= e0000165f8281de0
VHPT FAULT e00000008307cfc0 1010092a2018 IFA= e00000008189fe50 nt!SwapFromIdle+0x1e0
EXTERNAL INTERRUPT e0000000830623b0 1010092a6018 IVR= d0 nt!Kil_TopOfIdleLoop
VHPT FAULT e00000008314e310 1010092a2018 IFA= e0000165f88203f0 nt!KdReceivePacket+0x10
VHPT FAULT e000000083580760 1010092a2018 IFA= e0000000f00ff3fd hal!READ_PORT_UCHAR+0x80
PROCESS SWITCH e00000008558c990 e0000000818bbe10 OSP= e00000008189fe20
VHPT FAULT e00000008307cfc0 1010092a2018 IFA= e0000165f02433f0 nt!SwapFromIdle+0x1e0
VHPT FAULT 77cfbda0 1013082a6018 IFA= 77cfbda0 0x0000000077cfbda0
VHPT FAULT 77cfbdb0 1213082a6018 IFA= 6fbfee0ff98 0x0000000077cfbdb0
DATA ACCESS BIT 77b8e150 1213082a6018 IFA= 77c16ab8 0x0000000077b8e150
VHPT FAULT 77ed5d60 1013082a6018 IFA= 6fbfffa6048 0x0000000077ed5d60
DATA ACCESS BIT 77ed5d60 1213082a6018 IFA= 77c229c0 0x0000000077ed5d60
DATA ACCESS BIT 77b8e1b0 1013082a6018 IFA= 77c1c320 0x0000000077b8e1b0
USER SYSCALL 77cafa40 10082a6018 Num= 42 0x0000000077cafa40
VHPT FAULT e00000008344dc20 1010092a6018 IFA= e000010600703784 nt!ExpLookupHandleTableEntry+0x20
...
!ioresdes
!ioresdes 擴展顯示指定地址處的IO_RESOURCE_DESCRIPTOR結構。
語法
!ioresdes Address
參數
Address
指定IO_RESOURCE_DESCRIPTOR 結構的16進制地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
附加信息
查看Plug and Play調試獲得該擴展命令的應用。關於IO_RESOURCE_DESCRIPTOR結構的信息,查看 Windows Driver Kit (WDK) 文檔。
!ioreslist
!ioreslist 擴展顯示一個IO_RESOURCE_REQUIREMENTS_LIST結構。
語法
!ioreslist Address
參數
Address
指定IO_RESOURCE_REQUIREMENTS_LIST 結構的16進制地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kdexts.dll |
註釋
下面是該擴展輸出的示例:
kd> !ioreslist 0xe122b768
IoResList at 0xe122b768 : Interface 0x5 Bus 0 Slot 0xe
Alternative 0 (Version 1.1)
Preferred Descriptor 0 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000100 byte range with alignment 0x000100
1000 - 0x10ff
Alternative Descriptor 1 - Port (0x1) Device Exclusive (0x1)
Flags (0x01) - PORT_IO
0x000100 byte range with alignment 0x000100
0 - 0xffffffff
Descriptor 2 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x0 0x0
Preferred Descriptor 3 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x001000
40080000 - 0x40080fff
Alternative Descriptor 4 - Memory (0x3) Device Exclusive (0x1)
Flags (0000) - READ_WRITE
0x001000 byte range with alignment 0x001000
0 - 0xffffffff
Descriptor 5 - DevicePrivate (0x81) Device Exclusive (0x1)
Flags (0000) -
Data: : 0x1 0x1 0x0
Descriptor 6 - Interrupt (0x2) Shared (0x3)
Flags (0000) - LEVEL_SENSITIVE
0xb - 0xb
IO_RESOURCE_REQUIREMENTS_LIST包含這些信息:
- 資源類型
有四種類型的資源: I/O、內存、IRQ、DMA。
- 描述符(Descriptor)
每個首選設置都有一個"Preferred" 描述符和數個"Alternative"描述符。
資源列表包含下面這些需求:
- I/O 範圍
申請了0x1000 到0x10FF 的範圍,但是隻要按0x100對齊的話,可以使用從0到0xFFFFFFFF 之間任何0x100 長度的範圍,(例如,可以訪問0x1100 到0x11FF。)
- 內存
申請了0x40080000 到0x40080FFF的範圍,但是可以使用0到0xFFFFFFFF 之間以0x1000對齊的任何大小爲0x1000的範圍。
- IRQ
必須使用 IRQ 0xB。
中斷和DMA通道是以開始和結束相同的區域的形式。
附加信息
查看Plug and Play 調試獲得該擴展命令的應用。IO_RESOURCE_REQUIREMENTS_LIST結構的信息,查看Windows Driver Kit (WDK)文檔。
WinDbg 文檔翻譯----78
cc682/NetRoc
http://netroc682.spaces.live.com/
!eb, !ed
!eb 和!ed 擴展向指定的物理地址寫入一系列值。
這些命令不能和e* (Enter Values) 命令混淆。
語法
!eb [Flag] PhysicalAddress Data [ ... ]
!ed [Flag] PhysicalAddress Data [ ... ]
參數
Flag
可以是下面這些值中的一個。Flag 必須包含在中括號中:
[c]
寫入已緩衝內存(cached memory)。
[uc]
寫入未緩衝內存(uncached memory)。
[wc]
寫入寫聚合內存(write-combined memory)。
PhysicalAddress
指定在目標機物理內存中要寫入的開始地址,以16進制。
Data
指定要連續寫入物理內存的一個或多個值。以16進制輸入這些值。對於!eb 擴展,每個值都必須是1字節(兩個16進制數字)。對於!ed 擴展,每個值都必須是一個DWRODe(8個16進制數字)。一行中可以包含任意數量的 Data 值。使用逗號或者空格分隔多個值。
DLL
Windows NT 4.0 |
Kext.dll |
Windows 2000 |
Kext.dll |
Windows XP和之後 |
Kext.dll |
附加信息
使用!d* 擴展來讀取物理內存。內存操作的概述和其他內存相關命令的描述,查看 讀寫內存。
!ecb, !ecd, !ecw
!ecb、!ecd和!ecw 擴展向PCI配置空間(PCI configuration space)進行寫入。
語法
!ec Bus.Device.Function Offset Data
參數
Bus
指定總線。Bus可以從0到0xFF。
Device
指定設備的插槽設備號(slot device number)。
Function
指定設備的插槽功能號(slot function number)。
Offset
指定要寫入的地址。
Data
要寫入的數據。對於!ecb 擴展,Data 必須是1字節(兩個16進制數字)。對於!ecw 擴展,Data 必須是WORD(4個16進制數字)。 對於!ecd 擴展,Data必須是DWORD (8個16進制數字)。
DLL
Windows NT 4.0 |
Kext.dll |
Windows 2000 |
Kext.dll |
Windows XP和之後 |
Kext.dll |
這些命令只能對x86目標機使用。
註釋
不能用這幾個命令來寫入一系列Data值。要這樣做,只有通過重複使用它們。
使用!pci 100 Bus Device Function來顯示PCI配置空間(PCI configuration space)。
附加信息
查看Plug and Play調試獲得該擴展命令的應用,以及更多的例子。關於PCI總線的信息,查看Windows Driver Kit (WDK)文檔。
!ecs
!ecs 擴展已經廢棄。要編輯PCI配置空間(PCI configuration space),使用!ecb、 !ecd、或者!ecw。
!errlog
!errlog 擴展顯示I/O系統的錯誤日誌中任何掛起的條目(pending entry)的內容。
語法
!errlog
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
註釋
該命令顯示I/O系統錯誤日誌中的任何掛起事件(pending event)的信息。這些是通過調用IoWriteErrorLogEntry 函數排隊的事件,用來寫入系統的事件日誌中提供Event Viewer查看。
只有被IoWriteErrorLogEntry 排隊但是還沒有提交給錯誤日誌的條目會被顯示出來。
該命令可以在系統崩潰後用作診斷的輔助,因爲它會顯示系統崩潰時還沒來得及提交給錯誤日誌的那些掛起的錯誤信息。
附加信息
關於 IoWriteErrorLogEntry的更多信息,查看Windows Driver Kit (WDK)文檔。
!exca
!exca 擴展顯示PC-Card Interrupt Controller (PCIC) Exchangable Card Architecture (ExCA) registers。
語法
!exca BasePort.SocketNumber
參數
BasePort
指定PCIC的基礎端口(base port)。
SocketNumber
指定PCIC的ExCA寄存器的socket number。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kext.dll |
Windows XP和之後 |
Kext.dll |
!exca 擴展僅對x86目標機可用。
附加信息
!cbreg 擴展可以用來通過地址顯示CardBus Socket registers 和CardBus ExCA registers。
!exqueue
!exqueue 擴展顯示ExWorkerQueue 工作隊列(work queue)中當前被排隊的項目列表。
語法
!exqueue [Flags]
參數
Flags
可以是下面這些值的任意組合。默認值爲0x0,只顯示很有限的信息。
Bit 0 (0x1) |
如果沒有設置0x02的話,顯示時間和優先級統計。 |
Bit 1 (0x2) |
顯示工作隊列關聯的線程和事件列表,以及它們的等待狀態。 |
Bit 2 (0x4) |
顯示和工作隊列關聯的線程列表。如果沒有同時使用0x2,則每個線程顯示在單獨的一行上。如果使用了0x2,每個線程和一個堆棧回溯一起顯示。 |
Bit 3 (0x8) |
(Windows XP和之後) 在隊列的每個線程的顯示中加入返回地址、堆棧指針、以及(在Itanium系統中)bsp寄存器的值。不會顯示函數的參數。 |
Bit 4 (0x10) |
只顯示臨界工作隊列(critical work queue)。 |
Bit 5 (0x20) |
只顯示被延時工作隊列(delayed work queue)。 |
Bit 6 (0x40) |
只顯示超臨界工作隊列(hypercritical work queue)。 |
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
註釋
如果Flags 不包含bit 4、5、6,則顯示中包括臨界工作隊列 (critical work queue)、延時工作隊列(delayed work queue),以及超臨界工作隊列(hypercritical work queue)。
下面是該命令輸出的示例:
kd> !exqueue
Dumping ExWorkerQueue: 8046A5C0
**** Critical WorkQueue( current = 0 maximum = 1 )
THREAD fe502940 Cid 8.c Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe5026c0 Cid 8.10 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe502440 Cid 8.14 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe5021c0 Cid 8.18 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe501020 Cid 8.1c Teb: 00000000 Win32Thread: 00000000 WAIT
**** Delayed WorkQueue( current = 0 maximum = 1 )
THREAD fe501da0 Cid 8.20 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe501b20 Cid 8.24 Teb: 00000000 Win32Thread: 00000000 WAIT
THREAD fe5018a0 Cid 8.28 Teb: 00000000 Win32Thread: 00000000 WAIT
**** HyperCritical WorkQueue( current = 0 maximum = 1 )
THREAD fe501620 Cid 8.2c Teb: 00000000 Win32Thread: 00000000 WAIT
在!exqueue 輸出中的重要信息有:
參數 |
含義 |
current |
隊列中的運行中線程的數量;即隊列中非等待狀態的線程數量。 |
maximum |
隊列中任何給定時間點允許運行的線程數量。這個一般是由系統中處理器數量決定的。 |
系統會執行任何current 值比maximum 值小的隊列中的work item。如果current 大於或等於maximum ,則在有更多的隊列中的線程完成執行或者進入等待狀態之前,不會有新的work item被執行。該規則當某個CPU密集型work item正在執行並且不會進入等待狀態時會延遲系統,因爲它會阻止新的work item被執行,即使隊列中還有空閒線程。
附加信息
關於工作者線程的更多信息,查看Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!filecache
!filecache 擴展顯示系統文件緩存和PTE使用的信息。
語法
!filecache
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
註釋
該擴展命令的輸出中,每一行都是一個虛擬地址控制塊(virtual address control block (VACB))。當命名文件(named file)被映射到VACB中時,還會顯示這些文件的名字。如果出現"no name for file" ,則表示該VACB是用於緩存元數據(metadata)的。
下面是在Windows 2000系統上的一個示例:
kd> !filecache
***** Dump file cache******
File Cache Information
Current size 7088 kb
Peak size 11376 kb
loading file cache database...
File cache has 129 valid pages
Usage Summary in KiloBytes (Kb):
Control Valid Standby Dirty Shared Locked PageTables name
80994c08 248 0 0 0 0 0 No Name for File
80995c88 528 0 0 0 0 0 No Name for File
80992a28 120 0 0 0 0 0 No Name for File
80993d28 32 0 0 0 0 0 No Name for File
8098c1e8 8 0 0 0 0 0 mapped_file( SysEvent.Evt )
8091a908 8 0 0 0 0 0 No Name for File
8091d708 16 0 0 0 0 0 No Name for File
80992f08 8 0 0 0 0 0 No Name for File
8098ca48 8 0 0 0 0 0 No Name for File
80949ea8 8 0 0 0 0 0 No Name for File
80992828 16 0 0 0 0 0 No Name for File
8155c688 8 0 0 0 0 0 mapped_file( cmd.exe )
下面是在Windows XP系統上的一個示例:
kd> !filecache
***** Dump file cache******
Reading and sorting VACBs ...
Removed 1811 nonactive VACBs, processing 235 active VACBs ...
File Cache Information
Current size 28256 kb
Peak size 30624 kb
235 Control Areas
Skipping view @ c1040000 - no VACB, but PTE is valid!
Loading file cache database (100% of 131072 PTEs)
SkippedPageTableReads = 44
File cache has 4056 valid pages
Usage Summary (in Kb):
Control Valid Standby/Dirty Shared Locked Name
817da668 4 0 0 0 $MftMirr
8177ae68 304 920 0 0 $LogFile
81776160 188 0 0 0 $BitMap
817cf370 4 0 0 0 $Mft
81776a00 8 0 0 0 $Directory
817cfdd0 4 0 0 0 $Directory
81776740 36 0 0 0 No Name for File
817cf7c8 20 0 0 0 $Directory
817cfb98 304 0 0 0 $Directory
8177be40 16 0 0 0 $Directory
817dadc0 2128 68 0 0 $Mft
817cf008 4 0 0 0 $Directory
817d0258 8 4 0 0 $Directory
817763f8 4 0 0 0 $Directory
...
8173f058 4 0 0 0 $Directory
8173e628 32 0 0 0 $Directory
8173e4c8 32 0 0 0 $Directory
8173da38 4 0 0 0 $Directory
817761f8 4 0 0 0 $Directory
81740530 32 0 0 0 $Directory
8173d518 4 0 0 0 $Directory
817d9560 8 0 0 0 $Directory
8173f868 4 0 0 0 $Directory
8173fc00 4 0 0 0 $Directory
81737278 4 0 0 0 $MftMirr
81737c88 44 0 0 0 $LogFile
81735fa0 48 0 0 0 $Mft
81737e88 188 0 0 0 $BitMap
817380b0 4 0 0 0 $Mft
817399e0 4 0 0 0 $Directory
817382b8 4 0 0 0 $Directory
817388d8 12 0 0 0 No Name for File
81735500 8 0 0 0 $Directory
81718e38 232 0 0 0 default
81735d40 48 20 0 0 SECURITY
81723008 8632 0 0 0 software
816da3a0 24 44 0 0 SAM
8173dfa0 4 0 0 0 $Directory
...
8173ba90 4 0 0 0 $Directory
8170ee30 4 36 4 0 AppEvent.Evt
816223f8 4 0 0 0 $Directory
8170ec28 8 28 4 0 SecEvent.Evt
816220a8 4 0 0 0 $Directory
8170ea20 4 32 4 0 SysEvent.Evt
8170d188 232 0 0 0 NTUSER.DAT
81709f10 8 0 0 0 UsrClass.dat
81708918 232 0 0 0 NTUSER.DAT
81708748 8 0 0 0 UsrClass.dat
816c58f8 12 0 0 0 change.log
815c3880 4 0 0 0 $Directory
81706aa8 4 0 0 0 SchedLgU.Txt
815ba2d8 4 0 0 0 $Directory
815aa5f8 8 0 0 0 $Directory
8166d728 44 0 0 0 Netlogon.log
81701120 8 16 4 0 es.dll
816ff0a8 4 8 4 0 stdole2.tlb
8159a358 4 0 0 0 $Directory
8159da70 4 0 0 0 $Directory
8159c158 4 0 0 0 $Directory
815cb9b0 4 0 0 0 00000001
81779b20 4 0 0 0 $Directory
8159ac20 4 0 0 0 $Directory
815683f8 4 0 0 0 $Directory
81566978 580 0 0 0 NTUSER.DAT
81568460 4 0 0 0 $Directory
815675d8 68 0 0 0 UsrClass.dat
81567640 4 0 0 0 $Directory
...
81515878 4 0 0 0 $Directory
81516870 8 0 0 0 $Directory
8150df60 4 0 0 0 $Directory
...
816e5300 4 0 0 0 $Directory
8152afa0 16 212 0 0 msmsgs.exe
8153bbd8 4 32 0 0 stdole32.tlb
8172f950 488 392 0 0 OBJECTS.DATA
8173e9c0 4 0 0 0 $Directory
814f4538 4 0 0 0 $Directory
81650790 344 48 0 0 INDEX.BTR
814f55f8 4 0 0 0 $Directory
...
814caef8 4 0 0 0 $Directory
8171cd90 1392 36 0 0 system
815f07f0 4 0 0 0 $Directory
814a2298 4 0 0 0 $Directory
81541538 4 0 0 0 $Directory
81585288 28 0 0 0 $Directory
8173f708 4 0 0 0 $Directory
...
8158cf10 4 0 0 0 $Directory
附加信息
關於文件系統驅動的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon編寫的 Microsoft Windows Internals。
!filelock
!filelock 擴展顯示某個文件鎖結構(file lock structure)。
語法
Windows NT 4.0 和Windows 2000的語法
!filelock FileLockAddress
Windows XP和之後系統的語法
!filelock FileLockAddress
!filelock ObjectAddress
參數
FileLockAddress
指定文件鎖結構的16進制地址。
ObjectAddress
(Windows XP和之後) 指定擁有文件鎖的文件對象的16進制地址。
DLL
Windows NT 4.0 |
Kdextx86.dll |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
附加信息
關於文件對象的信息,查看Windows Driver Kit (WDK) 文檔,以及Mark Russinovich 和David Solomon編寫的 Microsoft Windows Internals 。
!fileobj
!fileobj 擴展顯示FILE_OBJECT 結構的詳細信息。
語法
!fileobj FileObject
參數
FileObject
指定FILE_OBJECT結構的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kexts.dll |
註釋
如果 FILE_OBJECT 結構擁有關聯的緩存,!fileobj 會嘗試解析並顯示緩存信息。
附加信息
關於文件對象的信息,查看Microsoft Windows SDK文檔、Windows Driver Kit (WDK)文檔、以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
!filetime
!filetime 擴展將一個64位FILETIME 結構轉換成可讀的時間形式。
語法
!filetime Time
參數
Time
指定一個64位FILETIME結構。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
註釋
下面是該擴展的輸出的示例:
kd> !filetime 1c4730984712348
7/26/2004 04:10:18.712 (Pacific Standard Time)
!finddata
!finddata 擴展顯示某個指定的文件對象給定偏移地址處的已緩存數據(cached data)。
語法
!finddata FileObject Offset
參數
FileObject
指定文件對象的地址。
Offset
指定偏移。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
Kdextx86.dll |
Windows XP和之後 |
Kexts.dll |
附加信息
關於緩存管理的信息,查看Microsoft Windows SDK 文檔,以及Mark Russinovich 和David Solomon 編寫的Microsoft Windows Internals。
關於其他緩存管理擴展命令的信息,查看!cchelp 命令。
!findfilelockowner
!findfilelockowner 擴展通過在所有線程中檢查某個阻塞在IopSynchronousServiceTail 斷言上,並且使用文件對象作爲參數的線程,來查找該文件對象的所有者。
語法
!findfilelockowner [FileObject]
參數
FileObject
指定文件對象的地址。如果省略FileObject,則命令搜索當前進程中所有在IopAcquireFileObjectLock 等待的線程並且從堆棧回溯中獲得文件對象的地址。
DLL
Windows NT 4.0 |
不可用 |
Windows 2000 |
不可用 |
Windows XP和之後 |
Kexts.dll |
註釋
當經歷了某次臨界區(critical section)超時,並且超時的線程是在IopAcquireFileObjectLock 中等待文件時,該擴展是最有用的。找到這個出問題的線程後,擴展命令會嘗試復原該請求的IRP,並且顯示正在處理該IRP的驅動程序。
該擴展命令由於要遍歷系統中所有線程的調用堆棧,直到找到出問題的線程,所以可能要花費一些時間。可以通過按下CTRL+BREAK (WinDbg中) 或者 CTRL+C (KD中)來中斷它。
附加信息
關於文件對象的信息,查看Microsoft Windows SDK 文檔、 Windows Driver Kit (WDK) 文檔、以及Mark Russinovich 和David Solomon編寫的 Microsoft Windows Internals。
!for_each_process
!for_each_process 擴展對目標機中的每個進程執行一次指定的調試器命令。
語法
!for_each_process ["CommandString"]
!for_each_process -?
參數
CommandString
指定要爲每個進程執行的調試器命令。
如果CommandString包含多條命令,則需要用分號(;)分隔他們,並且將CommandString包含在引號(")中。如果CommandString 被包含在引號中,則CommandString 中的命令不能包含引號。在CommandString中,@#Process 用來替換成進程的地址。
-?
在調試器命令窗口中顯示該擴展的幫助。