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.

67 lines
1.3 KiB

  1. //
  2. // DEBUG.H
  3. //
  4. // Copyright (C) Microsoft Corporation, 1995
  5. //
  6. #ifndef _DEBUG_
  7. #define _DEBUG_
  8. #ifdef DEBUG
  9. // Disable the "in-line assembler precludes global optimizations" warning
  10. // because of debug breaks.
  11. #pragma warning(disable:4704)
  12. #if !defined(WIN32) || defined(_X86_)
  13. #define TRAP() _asm {int 3}
  14. #else
  15. #define TRAP() DebugBreak()
  16. #endif
  17. VOID
  18. INTERNALV
  19. RgDebugPrintf(
  20. LPCSTR lpFormatString,
  21. ...
  22. );
  23. VOID
  24. INTERNAL
  25. RgDebugAssert(
  26. LPCSTR lpFile,
  27. UINT LineNumber
  28. );
  29. #define TRACE(x) RgDebugPrintf ##x
  30. #ifdef REGDEBUG
  31. #define NOISE(x) RgDebugPrintf ##x
  32. #else
  33. #define NOISE(x)
  34. #endif
  35. #define ASSERT(x) ((x) ? (VOID) 0 : RgDebugAssert(__FILE__, __LINE__))
  36. #define DECLARE_DEBUG_COUNT(var) int var = 0;
  37. #define INCREMENT_DEBUG_COUNT(var) ((var)++)
  38. #define DECREMENT_DEBUG_COUNT(var) ASSERT(((var)--))
  39. #if !defined(WIN32) || defined(_X86_)
  40. #define DEBUG_OUT(x) { TRACE(x); _asm {int 1}; }
  41. #else
  42. #define DEBUG_OUT(x) { TRACE(x); TRAP(); }
  43. #endif
  44. #else
  45. #define TRAP()
  46. #define TRACE(x)
  47. #define NOISE(x)
  48. #define ASSERT(x)
  49. #define DECLARE_DEBUG_COUNT(var)
  50. #define INCREMENT_DEBUG_COUNT(var)
  51. #define DECREMENT_DEBUG_COUNT(var)
  52. #define DEBUG_OUT(x)
  53. #endif
  54. #endif // _DEBUG_