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.

151 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1992-1996 Microsoft Corporation
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. This file contains the macros for debugging.
  7. Author:
  8. Jameel Hyder (jameelh@microsoft.com) July 1996
  9. Environment:
  10. Kernel mode
  11. Revision History:
  12. --*/
  13. #ifndef _DEBUG_
  14. #define _DEBUG_
  15. #define FILENUM_ARPS 0x010000
  16. #define FILENUM_MARS 0x020000
  17. #define FILENUM_NDIS 0x040000
  18. #define FILENUM_TIMER 0x080000
  19. #define FILENUM_DATA 0x100000
  20. #define FILENUM_REGISTRY 0x200000
  21. #define FILENUM_IOCTL 0x400000
  22. #define FILENUM_UTIL 0x800000
  23. #define DBG_LEVEL_LOUD 0x0000
  24. #define DBG_LEVEL_INFO 0x1000
  25. #define DBG_LEVEL_NOTICE 0x2000
  26. #define DBG_LEVEL_WARN 0x3000
  27. #define DBG_LEVEL_ERROR 0x4000
  28. #define DBG_LEVEL_FATAL 0x4000
  29. #define DBG_NO_HDR 0x0001
  30. #if DBG
  31. extern ULONG ArpSDebugLevel;
  32. extern ULONG MarsDebugLevel;
  33. #define ARPS_PAGED_CODE() \
  34. if (KeGetCurrentIrql() > APC_LEVEL) \
  35. { \
  36. DbgPrint("Pageable code called at IRQL %d, file %s, line %d\n", \
  37. KeGetCurrentIrql(), __FILE__, __LINE__); \
  38. }
  39. #define ARPS_GET_IRQL(_pIrql) *(_pIrql) = KeGetCurrentIrql();
  40. #define ARPS_CHECK_IRQL(_Irql) \
  41. { \
  42. KIRQL NowIrql = KeGetCurrentIrql(); \
  43. if (_Irql != NowIrql) \
  44. { \
  45. DbgPrint("***ATMARPS***: old irq %d != new irq %d!\n", \
  46. _Irql, NowIrql); \
  47. DbgPrint("File: %s, line %d\n", __FILE__, __LINE__);\
  48. DbgBreakPoint(); \
  49. } \
  50. }
  51. #define DBGPRINT(Level, Fmt) \
  52. { \
  53. if ((Level) >= ArpSDebugLevel) \
  54. { \
  55. if (((Level) & DBG_NO_HDR) == 0) \
  56. DbgPrint("***ATMARPS*** "); \
  57. DbgPrint Fmt; \
  58. } \
  59. }
  60. #define MARSDBGPRINT(Level, Fmt) \
  61. { \
  62. if ((Level) >= MarsDebugLevel) \
  63. { \
  64. if (((Level) & DBG_NO_HDR) == 0) \
  65. DbgPrint("MARS: "); \
  66. DbgPrint Fmt; \
  67. } \
  68. }
  69. #define MARSDUMPIPADDR(Level, Addr, Str) \
  70. { \
  71. if ((Level) >= MarsDebugLevel) \
  72. { \
  73. MarsDumpIpAddr(Addr, Str); \
  74. } \
  75. }
  76. #define MARSDUMPATMADDR(Level, Addr, Str) \
  77. { \
  78. if ((Level) >= MarsDebugLevel) \
  79. { \
  80. MarsDumpAtmAddr(Addr, Str); \
  81. } \
  82. }
  83. #define MARSDUMPMAP(Level, Str, IpAddr, pAtmAddr) \
  84. { \
  85. if ((Level) >= MarsDebugLevel) \
  86. { \
  87. MarsDumpMap(Str, IpAddr, pAtmAddr); \
  88. } \
  89. }
  90. #define DBGBRK(Level) \
  91. { \
  92. if ((Level) >= ArpSDebugLevel) \
  93. DbgBreakPoint(); \
  94. }
  95. #define LOG_ERROR(_s) DBGPRINT(DBG_LEVEL_ERROR, \
  96. ("***ATMARPS*** ErrLog (%lx)@ %s (%ld)\n", \
  97. _s, __FILE__, __LINE__));
  98. #define ARPS_ASSERT(exp) \
  99. { \
  100. if (!(exp)) \
  101. { \
  102. DbgPrint("***ATMARPS*** Assert " #exp " failed: file %s, line %d\n", \
  103. __FILE__, __LINE__); \
  104. DbgBreakPoint(); \
  105. } \
  106. }
  107. #else
  108. #define ARPS_PAGED_CODE()
  109. #define ARPS_GET_IRQL(_pIrql)
  110. #define ARPS_CHECK_IRQL(Irql)
  111. #define DBGPRINT(Level, Fmt)
  112. #define MARSDBGPRINT(Level, Fmt)
  113. #define MARSDUMPIPADDR(Level, Addr, Str)
  114. #define MARSDUMPATMADDR(Level, Addr, Str)
  115. #define MARSDUMPMAP(Level, Str, IpAddr, pAtmAddr)
  116. #define DBGBRK(Level)
  117. #define LOG_ERROR(s)
  118. #define ARPS_ASSERT(exp)
  119. #endif // DBG
  120. #endif // _DEBUG_