Hi,
I’m trying to debug my UMDF driver at boot time.
I have tried several ways, some of them specified in another thread at this forum (“Debugging a UMDF driver on BOOT in Vista”). All of them failed.
The first was WPP tracing - enabling an autologger in the registry. I’ve specified all the details in the other thread. If someone has any idea why this has failed, I would be happy to know…
The second was writing to a file using fopen_s, fprintf_s and fclose.
This method proved to be unreliable. For instance - I wrote several messages serially from the same function, and some of them were not written at all. That is - if I wrote messages A and B in this order, sometimes message A did not appear in the log file. Even though this is a dual-core system, and they are not necessarily supposed to be written one after the other, they should appear at some point in the file.
After the two methods above failed, I’ve tried debugging with WinDbg and an external machine (same as kernel debugging), using FireWire.
In one of the replies to my other thread, Peter mentioned that I can use DbgPrint to see what happens at boot. But according to the WDK documentation, it can only be used in kernel-mode drivers. Peter mentioned that I should use KD setup. What does this mean?
Anyway, I could not attach the external debugger to my UMDF module.
These are the configurations I have made:
- On the target machine: bcdedit /debug on
bcdedit 1394 channel:3 - On the host: I chose Kernel Debug and defined it to be 1394 with channel 3
- I defined in the registry of the target: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WUDF\Services{193a1820-d9ac-4997-8c55-be817523f6aa} - value 0x4. (I also tried with 0x8000004, just in case. Both failed. By the way, is this value in the documentation correct? It is written that the highest bit should be set, meaning that this value is incorrect. It should be 0x80000004 (one zero more)).
- I’ve defined in Event Filters - load module wudf* - enabled - handled.
I did this because unlike debugging from the machine itself (normal UMDF debugging), I couldn’t attach the debugger to the WUDFHost.exe process directly when I opened the debugger (this process does not exist on the host machine). - I’ve added breakpoints:
bu WUDFOsrUsbFx2!DllMain
bu WUDFOsrUsbFx2!DllGetClassObject
bu WUDFOsrUsbFx2!CMyDriver::OnDeviceAdd
And a few breakpoints in my code itself.
The results were - the host did connect to the target, it did stop somewhere, but not in those breakpoints (even when I pressed “go” several times), and breakpoints I’ve set manually on the code were not highlighted. They appeared in the breakpoints window, but only with line numbers, no symbols (and it is the exact same code of the driver).
This is what appeared in the debugger’s screen:
nt!DbgLoadImageSymbols+0x47:
81c55201 cc int 3
0: kd> g
nt!DbgLoadImageSymbols+0x47:
81c55201 cc int 3
0: kd> g
*** ERROR: Symbol file could not be found. Defaulted to export symbols for spsys.sys -
Keyboard Hook Success
nt!DbgLoadImageSymbols+0x47:
81c55201 cc int 3
1: kd> g
nt!DbgLoadImageSymbols+0x47:
81c55201 cc int 3
1: kd> g
UMDF: Waiting 4 seconds for debugger to attach.
*** ERROR: Module load completed but symbols could not be loaded for secdrv.SYS
UMDF: No user-mode debugger found.
UMDF: Waiting 4 seconds for debugger to attach.
UMDF: No user-mode debugger found.
I’ve been trying to attack this boot issue for more than two weeks now, and all the methods above failed. So if anyone has any suggestion (or a check-list) for any of the methods above, or could identify what I am doing wrong, or another idea how to debug a boot issue, I would be more than thankful.
Thanks,
Gadi