Today I got a callstack via email (from the NTDEV list), but no dump file. I needed to determine if the bugcheck was due to a KMDF or a USB core bug. Since I had no dump file, I had to work purely on what the message contained. The callstack did have symbols and offsets though, so I had a decent place to start. All in all, it took me less then 10 minutes from start to finish to fully debug the problem (which is funny because it took me more time to write this entry up ;) ).
The callstack looked like this:
eax=00000107 ebx=82d60104 ecx=82e69f5c edx=82e69f5c esi=82e69ce8 edi=8293c3e8 eip=f7813371 esp=f7b36a94 ebp=f7b36aac iopl=0 nv up ei pl nz ac pe cy cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010213 usbhub!USBH_SetPowerD0+0xd3: f7813371 8908 mov [eax],ecx f7b36aac f78134b2 82962cc0 00000100 8293c3e8 usbhub!USBH_SetPowerD0+0xd3 f7b36ac8 f7813727 8293c3e8 82962cc0 82962cc0 usbhub!USBH_PdoSetPower+0x80 f7b36ae8 f780b97b 82962d78 82962cc0 00000002 usbhub!USBH_PdoPower+0x201 f7b36b08 f78091d8 8293c3e8 82962cc0 f7b36b3c usbhub!USBH_PdoDispatch+0x83 f7b36b18 804e37f7 8293c330 82962cc0 82962d78 usbhub!USBH_HubDispatch+0x48 [...] f7b36b5c ed4da316 8293c330 8293c518 82962d9c nt!PoCallDriver+0x195 f7b36b7c ed4da3b9 f7b36bb8 8293ca00 ed4ec730 Wdf01000!FxPkgFdo::RaiseDevicePower+0x50 [...]
Not much to go on. What I really wanted to do was map usbhub!USBH_SetPowerD0+0xd3 to a line in the source file, but how could I do that? Then it occurred to me that I could load usbhub.sys as a dump file, unassemble at that offset and let the debugger do all the hard work for me. So, here is what I did:
C:\debuggers\windbg.exe -z usbhub.sys
:000> u USBH_SetPowerD0+0xd3 usbhub!USBH_SetPowerD0+0xd3 [[...] @ 596]: 0001c371 8908 mov [eax],ecx
InsertTailList(&fdoExt->ListHead, &PDO_EXT(pdo)->link);
Registers from the email eax=00000107 ebx=82d60104 ecx=82e69f5c edx=82e69f5c esi=82e69ce8 edi=8293c3e8 eip=f7813371 esp=f7b36a94 ebp=f7b36aac iopl=0 nv up ei pl nz ac pe cy cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00010213 0:000> dt [PDO DEVICE EXTENSION TYPE] link +0x108 link: _LIST_ENTRY
0:000> u usbhub!USBH_SetPowerD0+0xc0 usbhub!USBH_SetPowerD0+0xd3+1 usbhub!USBH_SetPowerD0+0xc0 [[...] @ 596]: 0001c35e e8834dffff call usbhub!PDO_EXT (000110e6) 0001c363 8d8e74020000 lea ecx,[esi+0x274] 0001c369 8b5104 mov edx,[ecx+0x4] 0001c36c 0508010000 add eax,0x108 0001c371 8908 mov [eax],ecx
0:000> dt [FDO DEVICE EXTENSION TYPE] ListHead +0x274 ListHead : _LIST_ENTRY
I am yet again surprised by the utility of windbg. It really helped me identify and quantify a bug with very little information to go by. Certainly not all debugging sessions are this easy, but it very gratifying when they are this easy and quick to diagnose.