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.

96 lines
2.5 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: debug.hxx
  7. //
  8. // Contents: Debug routines.
  9. //
  10. // Classes: None.
  11. //
  12. // Functions: TBD : Fill in.
  13. //
  14. // History: 08-Sep-95 EricB Created.
  15. // 01-Dec-95 MarkBl Split from util.hxx.
  16. //
  17. //----------------------------------------------------------------------------
  18. #ifndef __DEBUG_HXX__
  19. #define __DEBUG_HXX__
  20. //
  21. // debugging support
  22. //
  23. #if DBG == 1
  24. DECLARE_DEBUG(Sched)
  25. #define schDebugOut(x) SchedInlineDebugOut x
  26. #define schAssert(x) Win4Assert(x);
  27. #define InitDebug() InitializeDebugging()
  28. #define FMT_TSTR "%S"
  29. #define ERR_OUT(msg, hr) \
  30. if (hr == 0) { \
  31. schDebugOut((DEB_ERROR, #msg "\n")); \
  32. } else { \
  33. schDebugOut((DEB_ERROR, #msg " failed with error 0x%x\n", hr)); \
  34. }
  35. #define CHECK_HRESULT(hr) \
  36. if ( FAILED(hr) ) \
  37. { \
  38. schDebugOut((DEB_ERROR, \
  39. "**** ERROR RETURN <%s @line %d> -> %08lx\n", \
  40. __FILE__, \
  41. __LINE__, \
  42. hr)); \
  43. }
  44. #define TRACE(ClassName,MethodName) \
  45. schDebugOut((DEB_ITRACE, #ClassName"::"#MethodName"(0x%x)\n", this)); \
  46. if (SchedInfoLevel & DEB_USER1) HeapValidate(GetProcessHeap(), 0, NULL);
  47. #define TRACE2(ClassName,MethodName) \
  48. schDebugOut((DEB_USER2, #ClassName"::"#MethodName"(0x%x)\n", this)); \
  49. if (SchedInfoLevel & DEB_USER1) HeapValidate(GetProcessHeap(), 0, NULL);
  50. #define TRACE3(ClassName,MethodName) \
  51. schDebugOut((DEB_USER3, #ClassName"::"#MethodName"(0x%x)\n", this)); \
  52. if (SchedInfoLevel & DEB_USER1) HeapValidate(GetProcessHeap(), 0, NULL);
  53. #define TRACE_FUNCTION(FunctionName) \
  54. schDebugOut((DEB_ITRACE, #FunctionName"\n"));
  55. #define TRACE_FUNCTION3(FunctionName) \
  56. schDebugOut((DEB_USER3, #FunctionName"\n"));
  57. #define DBG_OUT(String) \
  58. schDebugOut((DEB_ITRACE, String "\n"));
  59. #define DBG_OUT3(String) \
  60. schDebugOut((DEB_USER3, String "\n"));
  61. #define DEB_IDLE DEB_USER4
  62. #else
  63. #define schDebugOut(x)
  64. #define schAssert(x)
  65. #define InitDebug()
  66. #define ERR_OUT(msg, hr)
  67. #define CHECK_HRESULT(hr)
  68. #define TRACE(ClassName,MethodName)
  69. #define TRACE2(ClassName,MethodName)
  70. #define TRACE3(ClassName,MethodName)
  71. #define TRACE_FUNCTION(FunctionName)
  72. #define TRACE_FUNCTION3(FunctionName)
  73. #define DBG_OUT(String)
  74. #define DBG_OUT3(String)
  75. #endif // DBG == 1
  76. #endif // __DEBUG_HXX__