Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get to see DbgPrint output from my kernel-mode driver?

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?

like image 948
Andrew Bainbridge Avatar asked May 18 '12 14:05

Andrew Bainbridge


2 Answers

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.

like image 183
snoone Avatar answered Oct 17 '22 00:10

snoone


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

like image 44
glagolig Avatar answered Oct 16 '22 22:10

glagolig