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.

232 lines
5.6 KiB

  1. /***
  2. *ClRtlDbg.h - Supports debugging features for clusters (from the C runtime library).
  3. *
  4. * Copyright (c) 1994-1998, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Support Cluster debugging features.
  8. *
  9. * [Public]
  10. *
  11. ****/
  12. #if _MSC_VER > 1000
  13. #pragma once
  14. #endif
  15. #ifndef __CLRTLDBG_H_
  16. #define __CLRTLDBG_H_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif /* __cplusplus */
  20. #ifndef CLRTL_INCLUDE_DEBUG_REPORTING
  21. /****************************************************************************
  22. *
  23. * Debug OFF
  24. * Debug OFF
  25. * Debug OFF
  26. *
  27. ***************************************************************************/
  28. #define _CLRTL_ASSERT(expr) ((void)0)
  29. #define _CLRTL_ASSERTE(expr) ((void)0)
  30. #define _CLRTL_RPT0(rptno, msg)
  31. #define _CLRTL_RPT1(rptno, msg, arg1)
  32. #define _CLRTL_RPT2(rptno, msg, arg1, arg2)
  33. #define _CLRTL_RPT3(rptno, msg, arg1, arg2, arg3)
  34. #define _CLRTL_RPT4(rptno, msg, arg1, arg2, arg3, arg4)
  35. #define _CLRTL_RPTF0(rptno, msg)
  36. #define _CLRTL_RPTF1(rptno, msg, arg1)
  37. #define _CLRTL_RPTF2(rptno, msg, arg1, arg2)
  38. #define _CLRTL_RPTF3(rptno, msg, arg1, arg2, arg3)
  39. #define _CLRTL_RPTF4(rptno, msg, arg1, arg2, arg3, arg4)
  40. #define _ClRtlSetReportHook(f) ((void)0)
  41. #define _ClRtlSetReportMode(t, f) ((int)0)
  42. #define _ClRtlSetReportFile(t, f) ((void)0)
  43. #define _ClRtlDbgBreak() ((void)0)
  44. #else /* CLRTL_INCLUDE_DEBUG_REPORTING */
  45. /****************************************************************************
  46. *
  47. * Debug ON
  48. * Debug ON
  49. * Debug ON
  50. *
  51. ***************************************************************************/
  52. /* Define _CLRTLIMP */
  53. #ifndef _CLRTLIMP
  54. //#ifdef _DLL
  55. //#define _CLRTLIMP __declspec(dllimport)
  56. //#else /* ndef _DLL */
  57. #define _CLRTLIMP
  58. //#endif /* _DLL */
  59. #endif /* _CLRTLIMP */
  60. /* Define NULL pointer value */
  61. #ifndef NULL
  62. #ifdef __cplusplus
  63. #define NULL 0
  64. #else
  65. #define NULL ((void *)0)
  66. #endif
  67. #endif
  68. /****************************************************************************
  69. *
  70. * Debug Reporting
  71. *
  72. ***************************************************************************/
  73. typedef void *_HFILE; /* file handle pointer */
  74. #define _CLRTLDBG_WARN 0
  75. #define _CLRTLDBG_ERROR 1
  76. #define _CLRTLDBG_ASSERT 2
  77. #define _CLRTLDBG_ERRCNT 3
  78. #define _CLRTLDBG_MODE_FILE 0x1
  79. #define _CLRTLDBG_MODE_DEBUG 0x2
  80. #define _CLRTLDBG_MODE_WNDW 0x4
  81. #define _CLRTLDBG_REPORT_MODE -1
  82. #define _CLRTLDBG_INVALID_HFILE ((_HFILE)-1)
  83. #define _CLRTLDBG_HFILE_ERROR ((_HFILE)-2)
  84. #define _CLRTLDBG_FILE_STDOUT ((_HFILE)-4)
  85. #define _CLRTLDBG_FILE_STDERR ((_HFILE)-5)
  86. #define _CLRTLDBG_REPORT_FILE ((_HFILE)-6)
  87. //#if defined(_DLL) && defined(_M_IX86)
  88. //#define _clrtlAssertBusy (*__p__clrtlAssertBusy())
  89. //_CLRTLIMP long * __cdecl __p__clrtlAssertBusy(void);
  90. //#else /* !(defined(_DLL) && defined(_M_IX86)) */
  91. //_CLRTLIMP extern long _clrtlAssertBusy;
  92. //#endif /* defined(_DLL) && defined(_M_IX86) */
  93. typedef int (__cdecl * _CLRTL_REPORT_HOOK)(int, char *, int *);
  94. _CLRTLIMP _CLRTL_REPORT_HOOK __cdecl _ClRtlSetReportHook(
  95. _CLRTL_REPORT_HOOK
  96. );
  97. _CLRTLIMP int __cdecl _ClRtlSetReportMode(
  98. int,
  99. int
  100. );
  101. _CLRTLIMP _HFILE __cdecl _ClRtlSetReportFile(
  102. int,
  103. _HFILE
  104. );
  105. _CLRTLIMP int __cdecl _ClRtlDbgReport(
  106. int,
  107. const char *,
  108. int,
  109. const char *,
  110. const char *,
  111. ...);
  112. /* Asserts */
  113. #define _CLRTL_ASSERT(expr) \
  114. do { if (!(expr) && \
  115. (1 == _ClRtlDbgReport(_CLRTLDBG_ASSERT, __FILE__, __LINE__, NULL, NULL))) \
  116. _ClRtlDbgBreak(); } while (0)
  117. #define _CLRTL_ASSERTE(expr) \
  118. do { if (!(expr) && \
  119. (1 == _ClRtlDbgReport(_CLRTLDBG_ASSERT, __FILE__, __LINE__, NULL, #expr))) \
  120. _ClRtlDbgBreak(); } while (0)
  121. /* Reports with no file/line info */
  122. #define _CLRTL_RPT0(rptno, msg) \
  123. do { if ((1 == _ClRtlDbgReport(rptno, NULL, 0, NULL, "%s", msg))) \
  124. _ClRtlDbgBreak(); } while (0)
  125. #define _CLRTL_RPT1(rptno, msg, arg1) \
  126. do { if ((1 == _ClRtlDbgReport(rptno, NULL, 0, NULL, msg, arg1))) \
  127. _ClRtlDbgBreak(); } while (0)
  128. #define _CLRTL_RPT2(rptno, msg, arg1, arg2) \
  129. do { if ((1 == _ClRtlDbgReport(rptno, NULL, 0, NULL, msg, arg1, arg2))) \
  130. _ClRtlDbgBreak(); } while (0)
  131. #define _CLRTL_RPT3(rptno, msg, arg1, arg2, arg3) \
  132. do { if ((1 == _ClRtlDbgReport(rptno, NULL, 0, NULL, msg, arg1, arg2, arg3))) \
  133. _ClRtlDbgBreak(); } while (0)
  134. #define _CLRTL_RPT4(rptno, msg, arg1, arg2, arg3, arg4) \
  135. do { if ((1 == _ClRtlDbgReport(rptno, NULL, 0, NULL, msg, arg1, arg2, arg3, arg4))) \
  136. _ClRtlDbgBreak(); } while (0)
  137. /* Reports with file/line info */
  138. #define _CLRTL_RPTF0(rptno, msg) \
  139. do { if ((1 == _ClRtlDbgReport(rptno, __FILE__, __LINE__, NULL, "%s", msg))) \
  140. _ClRtlDbgBreak(); } while (0)
  141. #define _CLRTL_RPTF1(rptno, msg, arg1) \
  142. do { if ((1 == _ClRtlDbgReport(rptno, __FILE__, __LINE__, NULL, msg, arg1))) \
  143. _ClRtlDbgBreak(); } while (0)
  144. #define _CLRTL_RPTF2(rptno, msg, arg1, arg2) \
  145. do { if ((1 == _ClRtlDbgReport(rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2))) \
  146. _ClRtlDbgBreak(); } while (0)
  147. #define _CLRTL_RPTF3(rptno, msg, arg1, arg2, arg3) \
  148. do { if ((1 == _ClRtlDbgReport(rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3))) \
  149. _ClRtlDbgBreak(); } while (0)
  150. #define _CLRTL_RPTF4(rptno, msg, arg1, arg2, arg3, arg4) \
  151. do { if ((1 == _ClRtlDbgReport(rptno, __FILE__, __LINE__, NULL, msg, arg1, arg2, arg3, arg4))) \
  152. _ClRtlDbgBreak(); } while (0)
  153. #if defined(_M_IX86) && !defined(_CLRTL_PORTABLE)
  154. #define _ClRtlDbgBreak() __asm { int 3 }
  155. #elif defined(_M_ALPHA) && !defined(_CLRTL_PORTABLE)
  156. void _BPT();
  157. #pragma intrinsic(_BPT)
  158. #define _ClRtlDbgBreak() _BPT()
  159. #else
  160. _CLRTLIMP void __cdecl _ClRtlDbgBreak(
  161. void
  162. );
  163. #endif
  164. #endif // CLRTL_INCLUDE_DEBUG_REPORTING
  165. #ifdef __cplusplus
  166. }
  167. #endif /* __cplusplus */
  168. #endif // __CLRTLDBG_H_