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

21,835

Solution 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.

Solution 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

Share:
21,835
Andrew Bainbridge
Author by

Andrew Bainbridge

Updated on July 09, 2022

Comments

  • Andrew Bainbridge
    Andrew Bainbridge almost 2 years

    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?

  • Andrew Bainbridge
    Andrew Bainbridge almost 12 years
    Thank you. That worked. I thought that DbgView was only capable of showing the same debug stream as Visual Studio shows in it's output window, but that's not true.
  • Andrew Bainbridge
    Andrew Bainbridge almost 12 years
    BTW, there is no need to boot Windows with "/debug" enabled for this to work either.
  • Andrew Bainbridge
    Andrew Bainbridge almost 12 years
    Thank you for taking the time to answer my question. I think your answer is a little bit misleading because I can do what I want without 2 machines. However, I agree that 2 machines are needed if you want to do full debugging with breakpoints etc.
  • CJBS
    CJBS almost 6 years