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.

168 lines
4.4 KiB

  1. //**************************************************************************
  2. //
  3. // DEBUG.H -- X2 Gaming Project
  4. //
  5. // Version 4.XX
  6. //
  7. // Copyright (c) 1998 Microsoft Corporation. All rights reserved.
  8. //
  9. // @doc
  10. // @topic DEBUG.H | Global definitions for debugging output.
  11. //**************************************************************************
  12. #ifndef CIC_DEBUG_H
  13. #define CIC_DEBUG_H
  14. //---------------------------------------------------------------------------
  15. // Definitions
  16. //---------------------------------------------------------------------------
  17. //
  18. // DEBUG output types (NOT LEVELS) - there is a similar
  19. // section of debug.h for gckernel, these need to be in sync
  20. //
  21. #ifndef DBG_ENTRY
  22. #define DBG_ENTRY 0x00000001 //Traceout on entry to function
  23. #define DBG_EXIT 0x00000002 //Traceout on exit from function
  24. #define DBG_WARN 0x00000004 //Traceout signifying a warning (or informational)
  25. #define DBG_TRACE 0x00000008 //Traceout signifying a warning (or informational)
  26. #define DBG_ERROR 0x00000010 //Traceout signifying an error
  27. #define DBG_CRITICAL 0x00000020 //Traceout signifying a critical error
  28. #define DBG_RT_ENTRY 0x00000040 //Traceout on entry to function (TIME CRITICAL CODE)
  29. #define DBG_RT_EXIT 0x00000080 //Traceout on exit from function (TIME CRITICAL CODE)
  30. #define DBG_RT_WARN 0x00000100 //Traceout signifying a warning (or informational) (TIME CRITICAL CODE)
  31. // Combos of above for setting warning levels easily
  32. #define DBG_NOT_RT 0x0000003F //Traceout all above except RT codes
  33. #define DBG_RT 0x000001C0 //Traceout RT codes
  34. #define DBG_WARN_ERROR 0x00000134 //Traceout warnings and errors including DBG_RT_WARN
  35. #define DBG_ALL 0xFFFFFFFF //Traceout all codes
  36. #endif
  37. #ifdef COMPILE_FOR_WDM_KERNEL_MODE
  38. #if (DBG==1)
  39. #define USE_CIC_DBG_TRACEOUTS
  40. #endif
  41. #endif
  42. #ifdef USE_CIC_DBG_TRACEOUTS
  43. //
  44. // Declaration for debug module
  45. //
  46. //
  47. // Must start file with a #define for the DEBUG module
  48. //
  49. //i.e. #define __DEBUG_MODULE_IN_USE__ GCKERNEL_DEBUG_MODULE
  50. #define DECLARE_MODULE_DEBUG_LEVEL(__x__)\
  51. ULONG __DEBUG_MODULE_IN_USE__ = __x__;
  52. #define SET_MODULE_DEBUG_LEVEL(__x__)\
  53. __DEBUG_MODULE_IN_USE__ = __x__;
  54. //
  55. // Conditional debug output procedures
  56. //
  57. #define CIC_DBG_ENTRY_PRINT(__x__)\
  58. if(__DEBUG_MODULE_IN_USE__ & DBG_ENTRY)\
  59. {\
  60. DbgPrint("CIC: ");\
  61. DbgPrint __x__;\
  62. }
  63. #define CIC_DBG_EXIT_PRINT(__x__)\
  64. if(__DEBUG_MODULE_IN_USE__ & DBG_EXIT)\
  65. {\
  66. DbgPrint("CIC: ");\
  67. DbgPrint __x__;\
  68. }
  69. #define CIC_DBG_WARN_PRINT(__x__)\
  70. if(__DEBUG_MODULE_IN_USE__ & DBG_WARN)\
  71. {\
  72. DbgPrint("CIC: ");\
  73. DbgPrint __x__;\
  74. }
  75. #define CIC_DBG_TRACE_PRINT(__x__)\
  76. if(__DEBUG_MODULE_IN_USE__ & DBG_TRACE)\
  77. {\
  78. DbgPrint("CIC: ");\
  79. DbgPrint __x__;\
  80. }
  81. #define CIC_DBG_ERROR_PRINT(__x__)\
  82. if(__DEBUG_MODULE_IN_USE__ & DBG_ERROR)\
  83. {\
  84. DbgPrint("CIC: ");\
  85. DbgPrint __x__;\
  86. }
  87. #define CIC_DBG_CRITICAL_PRINT(__x__)\
  88. if(__DEBUG_MODULE_IN_USE__ & DBG_CRITICAL)\
  89. {\
  90. DbgPrint("CIC: ");\
  91. DbgPrint __x__;\
  92. }
  93. #define CIC_DBG_RT_ENTRY_PRINT(__x__)\
  94. if(__DEBUG_MODULE_IN_USE__ & DBG_RT_ENTRY)\
  95. {\
  96. DbgPrint("CIC: ");\
  97. DbgPrint __x__;\
  98. }
  99. #define CIC_DBG_RT_EXIT_PRINT(__x__)\
  100. if(__DEBUG_MODULE_IN_USE__ & DBG_RT_EXIT)\
  101. {\
  102. DbgPrint("CIC: ");\
  103. DbgPrint __x__;\
  104. }
  105. #define CIC_DBG_RT_WARN_PRINT(__x__)\
  106. if(__DEBUG_MODULE_IN_USE__ & DBG_RT_WARN)\
  107. {\
  108. DbgPrint("CIC: ");\
  109. DbgPrint __x__;\
  110. }
  111. #define CIC_DBG_BREAK() DbgBreakPoint()
  112. #undef PAGED_CODE
  113. #define PAGED_CODE() \
  114. if (KeGetCurrentIrql() > APC_LEVEL) \
  115. {\
  116. CIC_DBG_CRITICAL_PRINT(("CIC: Pageable code called at IRQL %ld (file: %s, line:#%ld)\n", KeGetCurrentIrql(),__FILE__,__LINE__))\
  117. ASSERT(FALSE);\
  118. }
  119. #else // DBG=0
  120. #define CIC_DBG_ENTRY_PRINT(__x__)
  121. #define CIC_DBG_EXIT_PRINT(__x__)
  122. #define CIC_DBG_TRACE_PRINT(__x__)
  123. #define CIC_DBG_WARN_PRINT(__x__)
  124. #define CIC_DBG_ERROR_PRINT(__x__)
  125. #define CIC_DBG_CRITICAL_PRINT(__x__)
  126. #define CIC_DBG_RT_ENTRY_PRINT(__x__)
  127. #define CIC_DBG_RT_EXIT_PRINT(__x__)
  128. #define CIC_DBG_RT_WARN_PRINT(__x__)
  129. #define CIC_DBG_BREAK()
  130. #undef PAGED_CODE
  131. #define PAGED_CODE()
  132. #define DECLARE_MODULE_DEBUG_LEVEL(__x__)
  133. #define SET_MODULE_DEBUG_LEVEL(__x__)
  134. #endif // DBG=?
  135. //===========================================================================
  136. // End
  137. //===========================================================================
  138. #endif // CIC_DEBUG_H