Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
4.1 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract: ESC/POS (serial) interface for USB Point-of-Sale devices
  6. Author:
  7. ervinp
  8. Environment:
  9. Kernel mode
  10. Revision History:
  11. --*/
  12. #define BAD_POINTER ((PVOID)0xDEADDEAD)
  13. #define ISPTR(ptr) ((ptr) && ((ptr) != BAD_POINTER))
  14. /*
  15. * For X86 debug, wrap memory allocations so we can find leaks
  16. * (causes runtime alignment errors on IA64).
  17. */
  18. #define DBG_WRAP_MEMORY 0
  19. #if DBG
  20. #ifdef _X86_
  21. #undef DBG_WRAP_MEMORY
  22. #define DBG_WRAP_MEMORY 1
  23. #endif
  24. #endif
  25. #if DBG
  26. extern BOOLEAN dbgTrapOnWarn;
  27. extern BOOLEAN dbgVerbose;
  28. extern BOOLEAN dbgSkipSecurity;
  29. extern BOOLEAN dbgDumpBytes;
  30. #if DBG_WRAP_MEMORY
  31. extern ULONG dbgTotalMemCount;
  32. extern LIST_ENTRY dbgAllMemoryList;
  33. #endif
  34. #define DRIVERNAME "USB8023"
  35. #if WIN9X_BUILD
  36. #define DBG_LEADCHAR ' '
  37. #else
  38. #define DBG_LEADCHAR '\''
  39. #endif
  40. #define TRAP(msg) \
  41. { \
  42. DbgPrint("%c"DRIVERNAME"> Code coverage trap: '%s' file %s, line %d \n", DBG_LEADCHAR, (msg), __FILE__, __LINE__ ); \
  43. DbgBreakPoint(); \
  44. }
  45. #undef ASSERT
  46. #define ASSERT(fact) \
  47. if (!(fact)){ \
  48. DbgPrint("%c"DRIVERNAME"> Assertion '%s' failed: file %s, line %d \n", DBG_LEADCHAR, #fact, __FILE__, __LINE__ ); \
  49. DbgBreakPoint(); \
  50. }
  51. #define DBGWARN(args_in_parens) \
  52. { \
  53. DbgPrint("%c"DRIVERNAME"> *** WARNING *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  54. DbgPrint("%c > ", DBG_LEADCHAR); \
  55. DbgPrint args_in_parens; \
  56. DbgPrint("\n"); \
  57. if (dbgTrapOnWarn){ \
  58. DbgBreakPoint(); \
  59. } \
  60. }
  61. #define DBGERR(args_in_parens) \
  62. { \
  63. DbgPrint("%c"DRIVERNAME"> *** ERROR *** (file %s, line %d)\n", DBG_LEADCHAR, __FILE__, __LINE__ ); \
  64. DbgPrint("%c > ", DBG_LEADCHAR); \
  65. DbgPrint args_in_parens; \
  66. DbgPrint("\n"); \
  67. DbgBreakPoint(); \
  68. }
  69. #define DBGOUT(args_in_parens) \
  70. { \
  71. DbgPrint("%c"DRIVERNAME"> ", DBG_LEADCHAR); \
  72. DbgPrint args_in_parens; \
  73. DbgPrint("\n"); \
  74. }
  75. #define DBGVERBOSE(args_in_parens) \
  76. if (dbgVerbose){ \
  77. DbgPrint("%c"DRIVERNAME"> ", DBG_LEADCHAR); \
  78. DbgPrint args_in_parens; \
  79. DbgPrint("\n"); \
  80. }
  81. VOID InitDebug();
  82. VOID DbgShowBytes(PUCHAR msg, PUCHAR buf, ULONG len);
  83. VOID DbgShowMdlBytes(PUCHAR msg, PMDL mdl);
  84. PUCHAR DbgGetOidName(ULONG oid);
  85. VOID DbgDumpPacketStates(ADAPTEREXT *adapter);
  86. void DbgStallExecution(ULONG usec);
  87. ULONG DbgGetSystemTime_msec();
  88. #define INITDEBUG() InitDebug()
  89. #define DBGSHOWBYTES(msg, buf, len) DbgShowBytes(msg, buf, len)
  90. #define DBGSHOWMDLBYTES(msg, mdl) DbgShowMdlBytes(msg, mdl)
  91. #define DBGDUMPPACKETSTATES(adapterx) DbgDumpPacketStates(adapterx)
  92. #else
  93. #define DBGWARN(args_in_parens)
  94. #define DBGERR(args_in_parens)
  95. #define DBGOUT(args_in_parens)
  96. #define DBGVERBOSE(args_in_parens)
  97. #define TRAP(msg)
  98. #define INITDEBUG()
  99. #define DBGSHOWBYTES(msg, buf, len)
  100. #define DBGSHOWMDLBYTES(msg, mdl)
  101. #define DBGDUMPPACKETSTATES(adapterx)
  102. #endif