-->

How do I get to see DbgPrint output from my kernel

2020-08-26 03:21发布

问题:

I'm finding it difficult to see the debug output from a kernel-mode driver I'm working on.

I'm new to driver development. I'm trying to debug a USB driver on Windows XP. I've installed the DDK, and built a "checked mode" build of my driver. I've installed the driver and if I use a hex editor to look at my driver's .sys file in windows/drivers, I can see the text of my debug output strings.

If I run an app that uses my driver under Visual Studio, my debug output doesn't appear in the output window, as the application's own debug output does. Searching the web, I find many different claims about how one is supposed to display debug output from the kernel. For kernel debugging in general, people seem to either do remote debugging over a NULL modem cable (Crikey, it's 2012) or use a virtual machine and a virtual com port. Both these approaches seem like a massive amount of work just to be able to see debug output. Is there an alternative?

I've tried using WinDbg in "Local" kernel debugging mode but it doesn't show anything. It warned that I should reboot windows with "/debug" enabled. I did that, but it didn't help.

Any other ideas? Or am I asking for the impossible?

回答1:

DebugView will show you the trace messages from your driver:

http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

However, you really do need a two machine setup to do any real development work.



回答2:

The information you found is correct. You do need 2 machines to debug kernel-mode drivers.

If you choose to use 2 physical machines they can be connected via USB. NULL modem (COM port) is a common way to attach debugger to a virtual machine where VM's COM port is seen as a named pipe on the host, so you don't really need a NULL modem cable.

Couple of links

http://msdn.microsoft.com/en-us/library/ff538141.aspx

http://msdn.microsoft.com/en-us/library/ff542279.aspx