On 1/23/2012 12:30 AM, Thomas F. Divine wrote:
It there are crashes with WinDbg running - analyze them for heaven’s
sake!
If you are running the checked build of your driver, then you just
might have a flaw in one of your KdPrint statements. Perhaps bogus
formatting statement, etc. Flaws in your KdPrint’s wouldn’t appear if
you are running he free build of your driver.
In any case: Get crash -> Find YOUR bug. Don’t blame it on WinDbg or
DebugView.
Thomas F. Divine
http://www.pcausa.com
The main reason I ask about extra checks is that, for example, if I
attach WinDbg before
my KMDF-based device driver has loaded, I get a crash that doesn’t even
show my driver in the stack trace.
You can see that it crashes in IopLoadDriver (example at the bottom of
this message). If this doesn’t
normally happen, is it possibly an artifact of debugging a virtual
machine, etc.? The times when
the stack trace shows my code it tends to be an easy fix (not the most
complicated driver in the world),
but I keep running into this unusual sort. There is no problem if I
don’t attach WinDbg – the driver just loads.
EXCEPTION_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx
referenced memory at 0x%08lx. The memory could not be %s.
FAULTING_IP:
nt!IopLoadDriver+5aa
fffff800`01ea8986 0fb77844 movzx edi,word ptr [rax+44h]
EXCEPTION_RECORD: fffff88001fdbf88 – (.exr 0xfffff88001fdbf88)
ExceptionAddress: fffff80001ea8986 (nt!IopLoadDriver+0x00000000000005aa)
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000000
Parameter[1]: 0000000000000044
Attempt to read from address 0000000000000044
CONTEXT: fffff88001fdb6b0 – (.cxr 0xfffff88001fdb6b0)
rax=0000000000000000 rbx=0000000000000000 rcx=fffff88001fdc228
rdx=00000000c000007b rsi=0000000000000000 rdi=0000000000000000
rip=fffff80001ea8986 rsp=fffff88001fdc1c0 rbp=0000000020206f49
r8=fffff88007d8f000 r9=fffff88001fdc1a0 r10=fffff8a00193b060
r11=0000000000000000 r12=ffffffff80000718 r13=fffff98008f16fd0
r14=0000000000000000 r15=fffff88001fdc4cc
iopl=0 nv up ei ng nz na po nc
cs=0010 ss=0018 ds=002b es=002b fs=0053 gs=002b
efl=00010286
nt!IopLoadDriver+0x5aa:
fffff80001ea8986 0fb77844 movzx edi,word ptr [rax+44h] ds:002b:00000000
00000044=???
Resetting default scope
PROCESS_NAME: System
CURRENT_IRQL: 2
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%08lx
referenced memory at 0x%08lx. The memory could not be %s.
EXCEPTION_PARAMETER1: 0000000000000000
EXCEPTION_PARAMETER2: 0000000000000044
READ_ADDRESS: 0000000000000044
FOLLOWUP_IP:
nt!IopLoadDriver+5aa
fffff800`01ea8986 0fb77844 movzx edi,word ptr [rax+44h]
BUGCHECK_STR: 0x7E
DEFAULT_BUCKET_ID: NULL_CLASS_PTR_DEREFERENCE
LOCK_ADDRESS: fffff80001dc54c0 – (!locks fffff80001dc54c0)
Resource @ nt!PiEngineLock (0xfffff80001dc54c0) Exclusively owned
Contention Count = 6
NumberOfExclusiveWaiters = 1
Threads: fffffa8000d37040-01<*>
Threads Waiting On Exclusive Access:
fffffa8000d37680
1 total locks, 1 locks currently held
PNP_TRIAGE:
Lock address : 0xfffff80001dc54c0
Thread Count : 1
Thread address: 0xfffffa8000d37040
Thread wait : 0x105ee5c1
LAST_CONTROL_TRANSFER: from fffff80001684420 to fffff8000181c060
STACK_TEXT:
fffff88001fdc1c0 fffff800
01ef85d0 : ffffffff80000718 fffff800
02221300 fffff88001fdc400 fffff880
01fdc4cc :
nt!IopLoadDriver+0x5aa
fffff88001fdc490 fffff800
02144319 : fffff8a00123ecf8 00000000
00000001 fffff8a00123ecd8 00000000
0000001a :
nt!PipCallDriverAddDeviceQueryRoutine+0x47c
fffff88001fdc5a0 fffff800
02144779 : fffff88001fdc800 fffff8a0
0123ecb0 fffff88001fdc654 fffff880
01fdc7b8 :
nt!RtlpCallQueryRegistryRoutine+0x3b9
fffff88001fdc620 fffff800
01ef7c23 : fffff98040000000 ffffffff
80000740 fffff88001fdc800 fffff880
01fdc7b8 :
nt!RtlQueryRegistryValues+0x3c9
fffff88001fdc720 fffff800
01ef9b5c : fffffa8005a0ebd0 fffff880
01fdcbc0 fffffa8005a5d010 00000000
00000000 :
nt!PipCallDriverAddDevice+0x57b
fffff88001fdc8f0 fffff800
01efa72a : fffffa8005a5d010 fffffa80
05a29530 fffff88001fdcbc0 fffff800
00000002 :
nt!PipProcessDevNodeTree+0x208
fffff88001fdcb80 fffff800
0166f34c : fffffa8005a29530 00000000
00000000 0000000000000000 fffffa80
00d37148 :
nt!PiProcessReenumeration+0xc2
fffff88001fdcbe0 fffff800
017f87c6 : 0000000000000000 fffff800
0166ef34 fffff80001c90bf8 fffffa80
00d37040 :
nt!PnpDeviceActionWorker+0x418
fffff88001fdcc80 fffff800
02125a3d : 0000000000000001 fffffa80
00d37040 0000000000000080 00000000
00000000 :
nt!ExpWorkerThread+0x156
fffff88001fdcd10 fffff800
0181ba26 : fffff800017f8670 00000000
00000001 fffff880009b1180 00000000
00000000 :
nt!PspSystemThreadStartup+0x1a9
fffff88001fdcd80 00000000
00000000 : fffff88001fdd000 fffff880
01fd7000 fffff88001fdb150 00000000
00000000 :
nt!KxStartSystemThread+0x16
SYMBOL_STACK_INDEX: 0
SYMBOL_NAME: nt!IopLoadDriver+5aa