Source code of Windows XP (NT5)
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.

155 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1989-1993 Microsoft Corporation
  3. Module Name:
  4. Debug.h
  5. Abstract:
  6. This file contains debug printing constants for NBT.
  7. Author:
  8. Jim Stewart (Jimst) 10-2-92
  9. Revision History:
  10. --*/
  11. #ifndef _DEBUGNBT_H
  12. #define _DEBUGNBT_H
  13. //
  14. // Debug support.. this macro defines a check on a global flag that
  15. // selectively enables and disables debugging in different parts of NBT
  16. // NbtDebug is a global ULONG declared in driver.c
  17. //
  18. #if DBG
  19. extern ULONG NbtDebug;
  20. #endif // DBG
  21. // Assert support
  22. #if DBG
  23. #undef ASSERT
  24. #undef ASSERTMSG
  25. #define ASSERT( exp ) \
  26. if (!(exp)) { \
  27. DbgPrint( "Assertion \"%s\" failed at file %s, line %d\n", #exp, __FILE__, __LINE__ ); \
  28. if (NbtConfig.BreakOnAssert) \
  29. DbgBreakPoint(); \
  30. }
  31. #define ASSERTMSG( msg, exp ) \
  32. if (!exp) { \
  33. DbgPrint( "Message: %s\nAssertion \"%s\" failed at file %s, line %d\n", msg, #exp, __FILE__, __LINE__ ); \
  34. if (NbtConfig.BreakOnAssert) \
  35. DbgBreakPoint(); \
  36. }
  37. #endif
  38. #if DBG
  39. #define IF_DBG(flags) if(NbtDebug & flags)
  40. #define NBT_DEBUG_REGISTRY 0x00000001 // registry.c
  41. #define NBT_DEBUG_DRIVER 0x00000002 // driver.c
  42. #define NBT_DEBUG_NTUTIL 0x00000004 // ntutil.c
  43. #define NBT_DEBUG_TDIADDR 0x00000008 // tdiaddr.c
  44. #define NBT_DEBUG_TDICNCT 0x00000010 // tidaddr.c
  45. #define NBT_DEBUG_NETBIOS_EX 0x00000020 // NETBIOS_EX address type debugging
  46. #define NBT_DEBUG_NAME 0x00000040 // name.c
  47. #define NBT_DEBUG_NTISOL 0x00000080 // ntisol.c
  48. #define NBT_DEBUG_NBTUTILS 0x00000100 // nbtutils.c
  49. #define NBT_DEBUG_NAMESRV 0x00000200 // namesrv.c
  50. #define NBT_DEBUG_HNDLRS 0x00000400 // hndlrs.c
  51. #define NBT_DEBUG_PROXY 0x00000800 // proxy.c
  52. #define NBT_DEBUG_HASHTBL 0x00001000 // hashtbl.c
  53. #define NBT_DEBUG_UDPSEND 0x00002000 // udpsend.c
  54. #define NBT_DEBUG_TDIOUT 0x00004000 // tdiout.c
  55. #define NBT_DEBUG_SEND 0x00008000 // sends
  56. #define NBT_DEBUG_RCV 0x00010000 // rcvs
  57. #define NBT_DEBUG_RCVIRP 0x00020000 // rcv irp processing
  58. #define NBT_DEBUG_INDICATEBUFF 0x00040000 // tdihndlrs.c indicate buffer
  59. #define NBT_DEBUG_REFRESH 0x00080000 // refresh logic
  60. #define NBT_DEBUG_REF 0x00100000 // reference counts
  61. #define NBT_DEBUG_DISCONNECT 0x00200000 // Disconnects
  62. #define NBT_DEBUG_FILLIRP 0x00400000 // Filling the Irp(Rcv)
  63. #define NBT_DEBUG_LMHOST 0x00800000 // Lmhost file stuff
  64. #define NBT_DEBUG_FASTPATH 0x01000000 // Rcv code - fast path
  65. #define NBT_DEBUG_WINS 0x02000000 // Wins Interface debug
  66. #define NBT_DEBUG_PNP_POWER 0x04000000 // NT PNP debugging
  67. #define NBT_DEBUG_HANDLES 0x08000000 // To debug Handle RefCount issues
  68. #define NBT_DEBUG_TDIHNDLR 0x10000000 // tdihndlr.c
  69. #define NBT_DEBUG_MEMFREE 0x20000000 // memory alloc/free
  70. #define NBT_DEBUG_KDPRINTS 0x80000000 // KdPrint output
  71. //----------------------------------------------------------------------------
  72. //
  73. // Remove Debug spew on Debug builds!
  74. //
  75. #ifndef VXD
  76. #undef KdPrint
  77. #define KdPrint(_x_) \
  78. if (NbtDebug & NBT_DEBUG_KDPRINTS) \
  79. { \
  80. DbgPrint _x_; \
  81. }
  82. #endif // !VXD
  83. //----------------------------------------------------------------------------
  84. #else
  85. #define IF_DBG(flags)
  86. #endif
  87. /*
  88. * Software Tracing
  89. */
  90. #define WPP_CONTROL_GUIDS WPP_DEFINE_CONTROL_GUID(CtlGuid,(bca7bd7f,b0bf,4051,99f4,03cfe79664c1), \
  91. WPP_DEFINE_BIT(NBT_TRACE_PNP) \
  92. WPP_DEFINE_BIT(NBT_TRACE_NAMESRV) \
  93. WPP_DEFINE_BIT(NBT_TRACE_INBOUND) \
  94. WPP_DEFINE_BIT(NBT_TRACE_OUTBOUND) \
  95. WPP_DEFINE_BIT(NBT_TRACE_DISCONNECT) \
  96. WPP_DEFINE_BIT(NBT_TRACE_SEND) \
  97. WPP_DEFINE_BIT(NBT_TRACE_RECV) \
  98. WPP_DEFINE_BIT(NBT_TRACE_SENDDGRAM) \
  99. WPP_DEFINE_BIT(NBT_TRACE_RECVDGRAM) \
  100. WPP_DEFINE_BIT(NBT_TRACE_LOCALNAMES) \
  101. WPP_DEFINE_BIT(NBT_TRACE_REMOTECACHE) \
  102. WPP_DEFINE_BIT(NBT_TRACE_PROXY) \
  103. WPP_DEFINE_BIT(NBT_TRACE_VERBOSE) \
  104. )
  105. /*
  106. * Software tracing is available only in checked build
  107. */
  108. #if DBG
  109. #ifndef _NBT_WMI_SOFTWARE_TRACING_
  110. #define _NBT_WMI_SOFTWARE_TRACING_
  111. #endif
  112. #else
  113. #ifdef _NBT_WMI_SOFTWARE_TRACING_
  114. #undef _NBT_WMI_SOFTWARE_TRACING_
  115. #endif
  116. #endif
  117. #ifndef _NBT_WMI_SOFTWARE_TRACING_
  118. /*
  119. * Totally turn off software tracing
  120. */
  121. # define NbtTrace(l,m)
  122. # define WPP_ENABLED() (0)
  123. # define WPP_LEVEL_ENABLED(LEVEL) (0)
  124. #define WPP_LOGNBTNAME(x)
  125. #else
  126. int nbtlog_strnlen(char *p, int n);
  127. static CHAR NBTLOGNAME=0;
  128. #define WPP_LOGNBTNAME(x) \
  129. WPP_LOGPAIR(nbtlog_strnlen((char*)x,15),x) WPP_LOGPAIR(1,&NBTLOGNAME)
  130. #endif
  131. #endif