ReactOS  0.4.15-dev-313-g8fde48b
debug.h
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 1999
4 
5 Module Name:
6 
7  debug.h
8 
9 Abstract:
10 
11 
12 Author:
13 
14 Environment:
15 
16  kernel mode only
17 
18 Notes:
19 
20 
21 Revision History:
22 
23 --*/
24 
25 #pragma once
26 
27 VOID ClassDebugPrint(CLASS_DEBUG_LEVEL DebugPrintLevel, PCCHAR DebugMessage, ...);
28 
29 #if DBG
30 
31  typedef struct _CLASSPNP_GLOBALS {
32 
33  //
34  // whether or not to ASSERT for lost irps
35  //
36 
37  ULONG BreakOnLostIrps;
38  ULONG SecondsToWaitForIrps;
39 
40  //
41  // use a buffered debug print to help
42  // catch timing issues that do not
43  // reproduce with std debugprints enabled
44  //
45 
46  ULONG UseBufferedDebugPrint;
47  ULONG UseDelayedRetry;
48 
49  //
50  // the next four are the buffered printing support
51  // (currently unimplemented) and require the spinlock
52  // to use
53  //
54 
55  ULONG Index; // index into buffer
57  PSTR Buffer; // requires spinlock to access
58  ULONG NumberOfBuffers; // number of buffers available
59  SIZE_T EachBufferSize; // size of each buffer
60 
61  //
62  // interlocked variables to initialize
63  // this data only once
64  //
65 
68 
69  } CLASSPNP_GLOBALS, *PCLASSPNP_GLOBALS;
70 
71  #define DBGTRACE(dbgTraceLevel, args_in_parens) \
72  if (ClassDebug & (1 << (dbgTraceLevel+15))){ \
73  DbgPrint("CLASSPNP> *** TRACE *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
74  DbgPrint(" > "); \
75  DbgPrint args_in_parens; \
76  DbgPrint("\n"); \
77  if (DebugTrapOnWarn && (dbgTraceLevel == ClassDebugWarning)){ \
78  DbgBreakPoint(); \
79  } \
80  }
81  #define DBGWARN(args_in_parens) \
82  { \
83  DbgPrint("CLASSPNP> *** WARNING *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
84  DbgPrint(" > "); \
85  DbgPrint args_in_parens; \
86  DbgPrint("\n"); \
87  if (DebugTrapOnWarn){ \
88  DbgBreakPoint(); \
89  } \
90  }
91  #define DBGERR(args_in_parens) \
92  { \
93  DbgPrint("CLASSPNP> *** ERROR *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
94  DbgPrint(" > "); \
95  DbgPrint args_in_parens; \
96  DbgPrint("\n"); \
97  DbgBreakPoint(); \
98  }
99  #define DBGTRAP(args_in_parens) \
100  { \
101  DbgPrint("CLASSPNP> *** COVERAGE TRAP *** (file %s, line %d)\n", __FILE__, __LINE__ ); \
102  DbgPrint(" > "); \
103  DbgPrint args_in_parens; \
104  DbgPrint("\n"); \
105  DbgBreakPoint(); \
106  }
107 
108 
109  #define DBGGETIOCTLSTR(_ioctl) DbgGetIoctlStr(_ioctl)
110  #define DBGGETSCSIOPSTR(_pSrb) DbgGetScsiOpStr(_pSrb)
111  #define DBGGETSENSECODESTR(_pSrb) DbgGetSenseCodeStr(_pSrb)
112  #define DBGGETADSENSECODESTR(_pSrb) DbgGetAdditionalSenseCodeStr(_pSrb)
113  #define DBGGETADSENSEQUALIFIERSTR(_pSrb) DbgGetAdditionalSenseCodeQualifierStr(_pSrb)
114  #define DBGCHECKRETURNEDPKT(_pkt) DbgCheckReturnedPkt(_pkt)
115  #define DBGGETSRBSTATUSSTR(_pSrb) DbgGetSrbStatusStr(_pSrb)
116 
118  char *DbgGetIoctlStr(ULONG ioctl);
119  char *DbgGetScsiOpStr(PSCSI_REQUEST_BLOCK Srb);
120  char *DbgGetSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
121  char *DbgGetAdditionalSenseCodeStr(PSCSI_REQUEST_BLOCK Srb);
122  char *DbgGetAdditionalSenseCodeQualifierStr(PSCSI_REQUEST_BLOCK Srb);
123  VOID DbgCheckReturnedPkt(TRANSFER_PACKET *Pkt);
124  char *DbgGetSrbStatusStr(PSCSI_REQUEST_BLOCK Srb);
125 
126 
127  extern CLASSPNP_GLOBALS ClasspnpGlobals;
128  extern LONG ClassDebug;
129  extern BOOLEAN DebugTrapOnWarn;
130 
131 #else
132 
133  #define ClasspInitializeDebugGlobals()
134  #define DBGWARN(args_in_parens)
135  #define DBGERR(args_in_parens)
136  #define DBGTRACE(dbgTraceLevel, args_in_parens)
137  #define DBGTRAP(args_in_parens)
138 
139  #define DBGGETIOCTLSTR(_ioctl)
140  #define DBGGETSCSIOPSTR(_pSrb)
141  #define DBGGETSENSECODESTR(_pSrb)
142  #define DBGGETADSENSECODESTR(_pSrb)
143  #define DBGGETADSENSEQUALIFIERSTR(_pSrb)
144  #define DBGCHECKRETURNEDPKT(_pkt)
145  #define DBGGETSRBSTATUSSTR(_pSrb)
146 
147 #endif
_In_ PKSERVICE_ROUTINE _In_opt_ PVOID _In_opt_ PKSPIN_LOCK SpinLock
Definition: iofuncs.h:798
VOID ClassDebugPrint(CLASS_DEBUG_LEVEL DebugPrintLevel, PCCHAR DebugMessage,...)
Definition: debug.c:687
long LONG
Definition: pedump.c:60
#define ioctl
Definition: wintirpc.h:60
unsigned char BOOLEAN
static const UCHAR Index[8]
Definition: usbohci.c:18
ULONG_PTR SIZE_T
Definition: typedefs.h:79
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
signed char * PSTR
Definition: retypes.h:7
#define ClasspInitializeDebugGlobals()
Definition: debug.h:133
unsigned int ULONG
Definition: retypes.h:1
enum _CLASS_DEBUG_LEVEL CLASS_DEBUG_LEVEL
IN PSCSI_REQUEST_BLOCK Srb
Definition: class2.h:49
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34