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.

237 lines
13 KiB

  1. /**INC+**********************************************************************/
  2. /* Header: atrcint.h */
  3. /* */
  4. /* Purpose: Internal tracing functions header */
  5. /* */
  6. /* Copyright(C) Microsoft Corporation 1997 */
  7. /* */
  8. /****************************************************************************/
  9. /** Changes:
  10. * $Log: Y:/logs/h/dcl/atrcint.h_v $
  11. *
  12. * Rev 1.5 10 Jul 1997 18:06:00 AK
  13. * SFR1016: Initial changes to support Unicode
  14. *
  15. * Rev 1.4 10 Jul 1997 17:16:14 KH
  16. * SFR1022: Get 16-bit trace working
  17. **/
  18. /**INC-**********************************************************************/
  19. #ifndef _H_ATRCINT
  20. #define _H_ATRCINT
  21. /****************************************************************************/
  22. /* */
  23. /* CONSTANTS */
  24. /* */
  25. /****************************************************************************/
  26. /****************************************************************************/
  27. /* Internal trace state flags. Trace can be in one of three states: */
  28. /* */
  29. /* TRC_STATE_UNINTIALIZED : trace has been loaded but not been */
  30. /* initialized. If a call is made to output a */
  31. /* line then trace will automatically intialize */
  32. /* itself and move to TRC_STATE_INITIALIZED. */
  33. /* */
  34. /* TRC_STATE_INITIALIZED : this is the normal state - trace is loaded and */
  35. /* initialized. Outputting of trace lines is */
  36. /* permitted in this mode. */
  37. /* */
  38. /* TRC_STATE_TERMINATED : trace has been terminated. Outputting of */
  39. /* trace lines is no longer allowed and any calls */
  40. /* to output a line will be rejected. */
  41. /* */
  42. /****************************************************************************/
  43. #define TRC_STATE_UNINITIALIZED 0
  44. #define TRC_STATE_INITIALIZED 1
  45. #define TRC_STATE_TERMINATED 2
  46. /****************************************************************************/
  47. /* Internal trace status flags. These are used in the <trcStatus> field of */
  48. /* the TRC_SHARED_DATA structure. */
  49. /* */
  50. /* TRC_STATUS_ASSERT_DISPLAYED : is an assert box displayed? */
  51. /****************************************************************************/
  52. #define TRC_STATUS_ASSERT_DISPLAYED DCFLAG32(0)
  53. /****************************************************************************/
  54. /* Trace format definitions. These are used for printing various parts of */
  55. /* the trace lines. */
  56. /* */
  57. /* TIME is the time in the form hours, mins, secs, hundredths. */
  58. /* DATE is the date in the form day, month, year. */
  59. /* FUNC is the module function name. This is of variable size. */
  60. /* LINE is the line number within the source file. */
  61. /* PROC is the process identifier. */
  62. /* THRD is the thread identifier. */
  63. /* */
  64. /****************************************************************************/
  65. #define TRC_TIME_FMT _T("%02d:%02d:%02d.%02d")
  66. #define TRC_DATE_FMT _T("%02d/%02d/%02d")
  67. #define TRC_FUNC_FMT _T("%-*.*s")
  68. #define TRC_LINE_FMT _T("%04d")
  69. #define TRC_PROC_FMT _T("%04.4lx")
  70. #define TRC_THRD_FMT _T("%04.4lx")
  71. /****************************************************************************/
  72. /* Assert box title */
  73. /****************************************************************************/
  74. #define TRC_ASSERT_TITLE _T("ASSERTion failed")
  75. /****************************************************************************/
  76. /* Internal buffer sizes. */
  77. /* */
  78. /* TRC_NUM_PREFIXES : the number of prefixes supported. */
  79. /* TRC_PREFIX_LENGTH : the length of each prefix string. */
  80. /* TRC_MAX_SYMNAME_SIZE : the maximum length of a symbol name. */
  81. /****************************************************************************/
  82. #define TRC_NUM_PREFIXES 20
  83. #define TRC_PREFIX_LENGTH 8
  84. #define TRC_MAX_SYMNAME_SIZE 1024
  85. /****************************************************************************/
  86. /* Maximum number of functions to write out in a stack trace. */
  87. /****************************************************************************/
  88. #define TRC_MAX_SIZE_STACK_TRACE 100
  89. /****************************************************************************/
  90. /* */
  91. /* TYPEDEFS */
  92. /* */
  93. /****************************************************************************/
  94. /****************************************************************************/
  95. /* TRC_FILTER */
  96. /* ========== */
  97. /* The pointer to the filter definition for internal tracing */
  98. /* */
  99. /* trcStatus : status flag to prevent multiple assert displays. */
  100. /* trcPfxNameArray : prefix name array. */
  101. /* trcPfxLevelArray : prefix level array. */
  102. /* trcPfxFnLvlArray : prefix function entry/exit trace flag array. */
  103. /* trcPfxStartArray : prefix line number range start */
  104. /* trcPfxEndArray : prefix line number range end */
  105. /* */
  106. /****************************************************************************/
  107. typedef struct tagTRC_FILTER
  108. {
  109. DCUINT32 trcStatus;
  110. DCTCHAR trcPfxNameArray[TRC_NUM_PREFIXES][TRC_PREFIX_LENGTH];
  111. DCUINT32 trcPfxLevelArray[TRC_NUM_PREFIXES];
  112. DCBOOL32 trcPfxFnLvlArray[TRC_NUM_PREFIXES];
  113. DCUINT32 trcPfxStartArray[TRC_NUM_PREFIXES];
  114. DCUINT32 trcPfxEndArray[TRC_NUM_PREFIXES];
  115. } TRC_FILTER;
  116. typedef TRC_FILTER DCPTR PTRC_FILTER;
  117. /****************************************************************************/
  118. /* TRC_LINE */
  119. /* ======== */
  120. /* The TRC_LINE structure defines the format of a data trace line header. */
  121. /* */
  122. /* address : the address of the data block. */
  123. /* hexData : the data in hex format. */
  124. /* asciiData : the data in ascii format. */
  125. /* end : terminating characters at the end of the line (CR+LF). */
  126. /* */
  127. /****************************************************************************/
  128. typedef struct tagTRC_LINE
  129. {
  130. DCTCHAR address[10];
  131. DCTCHAR hexData[36];
  132. DCTCHAR asciiData[16];
  133. DCTCHAR end[3];
  134. } TRC_LINE;
  135. typedef TRC_LINE DCPTR PTRC_LINE;
  136. /****************************************************************************/
  137. /* */
  138. /* MACROS */
  139. /* */
  140. /****************************************************************************/
  141. /****************************************************************************/
  142. /* TRCInternalError */
  143. /* ================ */
  144. /* This macro outputs an internal error string to the debug console and */
  145. /* the trace file. */
  146. /****************************************************************************/
  147. #define TRCInternalError(pText) \
  148. { \
  149. TRCOutput(pText, DC_ASTRLEN(pText), TRC_LEVEL_ALT); \
  150. }
  151. /****************************************************************************/
  152. /* */
  153. /* FUNCTION PROTOTYPES */
  154. /* */
  155. /****************************************************************************/
  156. /****************************************************************************/
  157. /* */
  158. /* TRCCheckState */
  159. /* TRCDumpLine */
  160. /* TRCInternalTrace */
  161. /* TRCOutput */
  162. /* TRCReadFlag */
  163. /* TRCReadSharedDataConfig */
  164. /* TRCResetTraceFiles */
  165. /* TRCSetDefaults */
  166. /* TRCShouldTraceThis */
  167. /* TRCSplitPrefixes */
  168. /* TRCStrnicmp */
  169. /* TRCWriteFlag */
  170. /* TRCWriteSharedDataConfig */
  171. /* */
  172. /****************************************************************************/
  173. DCBOOL32 DCINTERNAL TRCCheckState(DCVOID);
  174. DCVOID DCINTERNAL TRCDumpLine(PDCUINT8 buffer,
  175. DCUINT length,
  176. DCUINT32 offset,
  177. DCUINT traceLevel);
  178. DCVOID DCINTERNAL TRCInternalTrace(DCUINT32 type);
  179. DCVOID DCINTERNAL TRCOutput(PDCTCHAR pText,
  180. DCINT length,
  181. DCINT traceLevel);
  182. DCVOID DCINTERNAL TRCReadFlag(PDCTCHAR entryName,
  183. DCUINT32 flag,
  184. PDCUINT32 pSetting);
  185. DCVOID DCINTERNAL TRCReadSharedDataConfig(DCVOID);
  186. DCVOID DCINTERNAL TRCResetTraceFiles(DCVOID);
  187. DCVOID DCINTERNAL TRCSetDefaults(DCVOID);
  188. DCBOOL DCINTERNAL TRCShouldTraceThis(DCUINT32 traceComponent,
  189. DCUINT32 traceLevel,
  190. PDCTCHAR pFileName,
  191. DCUINT32 lineNumber);
  192. DCVOID DCINTERNAL TRCSplitPrefixes(DCVOID);
  193. DCINT32 DCINTERNAL TRCStrnicmp(PDCTCHAR pSource,
  194. PDCTCHAR pTarget,
  195. DCUINT32 count);
  196. DCVOID DCINTERNAL TRCWriteFlag(PDCTCHAR entryName,
  197. DCUINT32 flag,
  198. DCUINT32 setting);
  199. DCVOID DCINTERNAL TRCWriteSharedDataConfig(DCVOID);
  200. DCVOID DCINTERNAL TRCNotifyAllTasks(DCVOID);
  201. /****************************************************************************/
  202. /* */
  203. /* OPERATING SYSTEM SPECIFIC INCLUDES */
  204. /* */
  205. /****************************************************************************/
  206. #include <wtrcint.h>
  207. #endif /* _H_ATRCINT */