Microsoft KB Archive/314743

= How to enable verbose debug tracing in various drivers and subsystems =

Article ID: 314743

Article Last Modified on 10/1/2007

-

APPLIES TO


 * Microsoft Windows XP Driver Development Kit
 * Microsoft Win32 Device Driver Kit for Windows 2000
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Datacenter Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows XP Home Edition
 * Microsoft Windows XP Professional

-



This article was previously published under Q314743



SUMMARY
When you debug device drivers, it is important that you receive verbose debug tracing from the drivers and related subsystems.

Most of the Microsoft-provided drivers and subsystems use global variables and a predefined set of values to control the verbosity of the debug tracing information that is sent to the debugger.

This article discusses the following topics:
 * How to enable and control the debug tracing level by using a kernel debugger and registry values.
 * For a certain class of drivers, you can use the corresponding debugger extensions to enable and control debug tracing.
 * The differences between enabling debug tracing in Windows 2000 and Windows XP.



MORE INFORMATION
Important This article contains information about running .chk files for development and testing purposes. Microsoft Product Support Services (PSS) does not support production systems that have .chk files installed unless you were told by PSS to install the .chk files to isolate a problem. Before you install .chk files on a production system, make sure to back up the system, and make sure that you understand how to restore the replaced file if a problem occurs.

For more information about .chk files, click the following article numbers to view the articles in the Microsoft Knowledge Base:

103659 Setup hangs while inspecting hardware; how to use Ntdetect.com

320040 How to use Ntdetect.chk to identify hardware problems in Windows 2000

For information about how to back up and restore the system, view Windows 2000 Help and support. For more information about NTbackups, click the following article numbers to view the articles in the Microsoft Knowledge Base:

240363 How to use the Backup program to back up and restore the system state in Windows 2000

You can also contact your backup product provider for information about how to use their product.

Note The following debugging information is subject to change at any time and is intended only for driver-debugging purposes. Also note that debug information may not be particularly useful to anyone other than developers.

Video miniport debugging
Note the following about video miniport debugging:  It requires checked build video port and miniport drivers. It does not use a debugger extension. It enables debug tracing by setting the global variable (or variables). Variable names in Windows 2000 are different from those in Windows XP. In Windows 2000, you can enable debug tracing either through the registry or the debugger, as follows:  Set the value of VideoDebugLevel (0-3) in the registry, as follows:  Or through the debugger, as follows:

ed videoprt!VideoDebugLevel 2

</li></ul> </li> The video port on a Windows XP-based computer uses the new DbgPrintEx function (see the &quot;NOTES&quot; section of this article).

The following variables are defined for video drivers:

Kd_IHVVIDEO_Mask

Kd_VIDEO_Mask

Kd_VIDEOPRT_Mask

To set a mask, do the following: <ul> Add the mask that you want in the registry. For example: </li> Or in the debugger, as follows:

ed Kd_IHVVIDEO_Mask 0xffffffff

</li></ul> </li></ul>

1394 debugging
Note the following about 1394 debugging: <ul> It requires a checked build system or checked build 1394 modules.</li> On both Windows 2000 and Windows XP-based systems, set the corresponding global variable through the debugger. For example:

ed ohci1394!ohcidebuglevel 6

For more information, click the following article number to view the article in the Microsoft Knowledge Base:

259855 How to enable debug prints in IEEE 1394 drivers

</li></ul>

USB debugging
Note the following about universal serial bus (USB) debugging: <ul> It requires a checked build system or checked build USB modules.</li> On a Windows 2000-based system, you need to set the corresponding global variable through the debugger. For example:

ed USBD!USBD_Debug_Trace_Level 2

</li> Use the following parameters on a Windows XP-based system. </li> All USB miniport drivers use USBPORT for debug output.</li></ul>

PCI debugging
Note the following about Peripheral Component Interconnect (PCI) debugging: <ul> It requires a checked build system or a checked build PCI.SYS module.</li> On both Windows 2000 and Windows XP-based systems, set the corresponding global variable through the debugger. For example (with 0x3 being the most verbose:

ed PCI!PciDebug 0x3

</li></ul>

PCMCIA debugging
Note the following about PCMCIA debugging: <ul> It requires a checked build system or a checked build pcmcia module.</li>  On both Windows 2000 and Windows XP-based systems, set the corresponding global variable through the debugger. For example

ed PCMCIA!PcmciaDebugMask 0xFFFFFFFF

where: </li></ul>
 * 1) define PCMCIA_DEBUG_ALL      0xFFFFFFFF
 * 2) define PCMCIA_DEBUG_TUPLES   0x00000001
 * 3) define PCMCIA_DEBUG_ENABLE   0x00000002
 * 4) define PCMCIA_DEBUG_PARSE    0x00000004
 * 5) define PCMCIA_DUMP_CONFIG    0x00000008
 * 6) define PCMCIA_DEBUG_INFO     0x00000010
 * 7) define PCMCIA_DEBUG_IOCTL    0x00000020
 * 8) define PCMCIA_DEBUG_DPC      0x00000040
 * 9) define PCMCIA_DEBUG_ISR      0x00000080
 * 10) define PCMCIA_DEBUG_CANCEL   0x00000100
 * 11) define PCMCIA_DUMP_SOCKET    0x00000200
 * 12) define PCMCIA_READ_TUPLE     0x00000400
 * 13) define PCMCIA_SEARCH_PCI     0x00000800
 * 14) define PCMCIA_DEBUG_FAIL     0x00008000
 * 15) define PCMCIA_PCCARD_READY   0x00010000
 * 16) define PCMCIA_DEBUG_DETECT   0x00020000
 * 17) define PCMCIA_COUNTERS       0x00040000
 * 18) define PCMCIA_DEBUG_OVERRIDES 0x00080000
 * 19) define PCMCIA_DEBUG_IRQMASK  0x00100000

NDIS debugging
Note the following about network driver interface specification (NDIS) debugging:
 * NDIS debugging requires a checked build NDIS.

Storage driver debugging
Note the following about storage driver debugging: <ul> It requires a checked build system or checked build storage modules. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

296225 How to enable SCSIPORT debug logging

</li></ul>

Printer driver debugging
Note the following about printer driver debugging.

User mode
<ul> Requires a checked build system or checked build printer driver components (unidrv or pscript).</li> <li>Attach to either the printing application or the spooler process (spoolsv.exe), depending on whether you are debugging the user interface (UI) module or the rendering module.</li> <li>For Unidrv debugging, use the following setting:

ed unidrv!giDebugLevel 1

</li></ul>

Kernel mode

 * Run the gflags command, and then enable the following flag on spoolsv.exe:
 * Windows 2000: &quot;Place Heap Allocation at end of pages&quot;
 * Windows XP: &quot;enable page heap&quot;
 * Restart the spooler (net stop/start spooler).
 * Run verifier.exe on Win32K.sys to debug your printer driver.

Audio driver debugging
Note the following about audio driver debugging: <ul> <li>It requires a checked build system or checked build audio modules.</li> <li>On both Windows 2000 and Windows XP-based systems, set the corresponding global variable through the debugger. For example:

ed USBAUDIO!USBAudioDebugLevel 3

</li></ul>

HID driver debugging
Note the following about HID driver debugging: <ul> <li>It requires a checked build system or checked build HID modules.</li> <li>On both Windows 2000 and Windows XP-based systems, set the corresponding global variable through the debugger. For example:

ed HIDCLASS!dbgverbose 1

</li></ul>

Serial driver debugging
Note the following about serial driver debugging: <ul> <li>It requires a checked build system or checked build serial modules.</li> <li>Serial.sys (on both Windows 2000 and Windows XP-based systems): <ul> <li>Set the DebugLevel value in the registry, as follows:

HKLM\System\CurrentControlSet\Services\Serial “DebugLevel”= REG_DWORD:0xFFFFFFFF

Or set it through the debugger, as follows:

ed Serial!SerialDebugLevel (0x00000000 – 0xFFFFFFFF)

</li> <li>Mask values are defined in the following directory:

%DDKROOT%\src\kernel\serial\serial.h

</li></ul> </li> <li>Serenum.sys (on both Windows 2000 and Windows XP-based systems): <ul> <li>Set the DebugLevel value in the registry, as follows:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Serenum “DebugLevel”= REG_DWORD:1FF

</li> <li>Mask values are defined in the following directory:

%DDKROOT%\src\kernel\serenum\serenum.h

</li></ul> </li></ul>

Modem driver debugging
To enable full unimodem verbose debugging on Windows 2000 and Windows XP-based systems, you need to have a checked build, and then do the following: <ol> <li>For everything except Mdminst.dll and Unimdm.tsp, add the following registry keys: <ul> <li> </li> <li> </li> <li> </li> <li> </li></ul> </li> <li> For Mdminst.dll, copy Unimdm.ini into. The following is an example of a Unimdm.ini file: [ModemUI] DumpFlags=0x0000000f
 * DumpFlags:
 * 00000001  DCB
 * 00000002  MODEMSETTINGS
 * 00000004  DEVCAPS

TraceFlags=0x0000000f
 * TraceFlags:
 * 00000001  Warnings
 * 00000002  Errors
 * 00000004  General
 * 00000008  Function trace

BreakFlags=0x00000000
 * BreakFlags:
 * 00000001  Break on validate
 * 00000040  Break on process attach
 * 00000100  Break on API enter



[Modem] DumpFlags=0x0000000f
 * DumpFlags:

TraceFlags=0x0003000f
 * TraceFlags:
 * 00000001  Warnings
 * 00000002  Errors
 * 00000004  General
 * 00000008  Function trace
 * 00010000  Detection queries
 * 00020000  Class installer trace

BreakFlags=0x00000000
 * BreakFlags:
 * 00000001  Break on validate
 * 00000040  Break on process attach
 * 00000100  Break on API enter



[SerialUI] DumpFlags=0x00000000
 * DumpFlags:
 * 00000001  DCB

TraceFlags=0x00000000
 * TraceFlags:
 * 00000001  Warnings
 * 00000002  Errors
 * 00000004  General
 * 00000008  Function trace

BreakFlags=0x00000000
 * BreakFlags:
 * 00000001  Break on validate
 * 00000040  Break on process attach
 * 00000100  Break on API enter



[Unimdm] DumpFlags=0x0000000f
 * DumpFlags:

TraceFlags=0x001f000f
 * TraceFlags:
 * 00000001  Warnings
 * 00000002  Errors
 * 00000004  General
 * 00000008  Function trace
 * 00010000  dwDeviceID related
 * 00020000  hdLine related
 * 00040000  hdCall related
 * 00080000  pLineDev related
 * 00100000  pModemInfo related

BreakFlags=0x00000000 </li> <li>For Unimdm.tsp debugging, add the following registry key:
 * BreakFlags:
 * 00000001  Break on validate
 * 00000040  Break on process attach
 * 00000080  Break on process detach
 * 00000100  Break on API enter

</li></ol>

Device installation debugging
To receive a verbose trace from kernel and usermode PNP manager on Windows XP and later versions, you have to obtain a checked build, and then run following code:

<pre class="fixed_text">ed NT!Kd_NTOSPNP_Mask 0xFFFFFFFF ed NT!Kd_PNPMGR_Mask 0xFFFFFFFF

On Windows 2000, you can set global variable PnpEnumDebugLevel to 1 or 2 in the kernel debugger as follows:

<pre class="fixed_text">ed nt!PnpEnumDebugLevel 2