| INFO: Debug Printing Implementation in the Device DriversID: Q90082 
 | 
Each device driver uses its own method for debug printing. There are
things that each method will have in common.
Many of the drivers use a debug print routine that controls the level of
debug messages that are printed. Debug printing can also typically be
disabled. Here are some examples of the different print routines and how
they are used:
   COM driver                           SerialDump()
   AT disk controller                   AtDump()
   SCSI class, port, and miniport       DebugPrint() 
   #if DBG
   #define DebugPrint(x)  ScsiDebugPrint x
   #else
   #define DebugPrint(x)
   #endif 
   DebugPrint((1,"ScsiCdRomRead: Invalid I/O parameters\n")); 
   #if DBG
   #define SerialDump(LEVEL, STRING) \ 
      do {\ 
         if(SerialDebugLevel & LEVEL){\ 
            DbgPrint STRING; \ 
         }\ 
         if(LEVEL == SERBUGCHECK){\ 
            ASSERT(FALSE);\ 
         }\ 
      }while(0)
   #else
   #define SerialDump(LEVEL, STRING) do {NOTHING;} while(0)
   #endif 
For the COM driver, the global variable used to store the current
message level is SerialDebugLevel. See INITUNLO.C to examine this
variable's usage. For the AT ESDI disk driver, the variable used is
AtDebugLevel. See ATDISK.C for this variables usage. The global variable
for SCSI drivers is ScsiDebug. All of these variables (SerialDebugLevel,
AtDebugLevel and ScsiDebug) have a default value of 0 and could be
modified to produce more debugging output.
Note, since source code for SCSIPORT.SYS is not available with the NT
DDK, this variable can only be modified from the kernel debugger in the
following manner:
   kd >ed scsiport!scsidebug 3
   kd >g 
Keywords          : NTDDKDebug 
Version           : WINNT:3.1,3.5,3.51;
Platform          : winnt 
Issue type        : kbinfo Last Reviewed: March 2, 1999