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.

164 lines
5.5 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Callback notification routines.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2001.
  6. //
  7. //----------------------------------------------------------------------------
  8. #ifndef __CALLBACK_H__
  9. #define __CALLBACK_H__
  10. //
  11. // Notification compression support. If the current notification
  12. // level is above zero notifications are not actually sent
  13. // to clients. This allows code that knows it will be
  14. // causing many similar notifications to bracket their operation
  15. // with an increment/decrement, suppressing notifications
  16. // during the bracket.
  17. // Due to the counted nature it nests properly.
  18. //
  19. // This support is primarily for the Change* callbacks.
  20. // Using it with the event callbacks is only partially supported.
  21. //
  22. extern ULONG g_EngNotify;
  23. ULONG ExecuteEventCommand(ULONG EventStatus, DebugClient* Client,
  24. PCSTR Command);
  25. //
  26. // Event callbacks.
  27. //
  28. HRESULT NotifyBreakpointEvent(ULONG Vote, Breakpoint* Bp);
  29. HRESULT NotifyExceptionEvent(PEXCEPTION_RECORD64 Record,
  30. ULONG FirstChance, BOOL OutputDone);
  31. HRESULT NotifyCreateThreadEvent(ULONG64 Handle,
  32. ULONG64 DataOffset,
  33. ULONG64 StartOffset,
  34. ULONG Flags);
  35. HRESULT NotifyExitThreadEvent(ULONG ExitCode);
  36. HRESULT NotifyCreateProcessEvent(ULONG64 ImageFileHandle,
  37. ULONG64 Handle,
  38. ULONG64 BaseOffset,
  39. ULONG ModuleSize,
  40. PSTR ModuleName,
  41. PSTR ImageName,
  42. ULONG CheckSum,
  43. ULONG TimeDateStamp,
  44. ULONG64 InitialThreadHandle,
  45. ULONG64 ThreadDataOffset,
  46. ULONG64 StartOffset,
  47. ULONG Flags,
  48. ULONG Options,
  49. ULONG InitialThreadFlags);
  50. HRESULT NotifyExitProcessEvent(ULONG ExitCode);
  51. HRESULT NotifyLoadModuleEvent(ULONG64 ImageFileHandle,
  52. ULONG64 BaseOffset,
  53. ULONG ModuleSize,
  54. PSTR ModuleName,
  55. PSTR ImageName,
  56. ULONG CheckSum,
  57. ULONG TimeDateStamp);
  58. HRESULT NotifyUnloadModuleEvent(PCSTR ImageBaseName,
  59. ULONG64 BaseOffset);
  60. HRESULT NotifySystemErrorEvent(ULONG Error,
  61. ULONG Level);
  62. HRESULT NotifySessionStatus(ULONG Status);
  63. void NotifyChangeDebuggeeState(ULONG Flags, ULONG64 Argument);
  64. void NotifyChangeEngineState(ULONG Flags, ULONG64 Argument,
  65. BOOL HaveEngineLock);
  66. void NotifyChangeSymbolState(ULONG Flags, ULONG64 Argument,
  67. PPROCESS_INFO Process);
  68. //
  69. // Input callbacks.
  70. //
  71. ULONG GetInput(PCSTR Prompt, PSTR Buffer, ULONG BufferSize);
  72. //
  73. // Output callbacks.
  74. //
  75. #define DEFAULT_OUT_MASK \
  76. (DEBUG_OUTPUT_NORMAL | DEBUG_OUTPUT_ERROR | \
  77. DEBUG_OUTPUT_PROMPT | DEBUG_OUTPUT_PROMPT_REGISTERS | \
  78. DEBUG_OUTPUT_WARNING | DEBUG_OUTPUT_EXTENSION_WARNING | \
  79. DEBUG_OUTPUT_DEBUGGEE | DEBUG_OUTPUT_DEBUGGEE_PROMPT)
  80. #define DEFAULT_OUT_HISTORY_MASK \
  81. (DEBUG_OUTPUT_NORMAL | DEBUG_OUTPUT_ERROR | \
  82. DEBUG_OUTPUT_PROMPT_REGISTERS | \
  83. DEBUG_OUTPUT_WARNING | DEBUG_OUTPUT_EXTENSION_WARNING | \
  84. DEBUG_OUTPUT_DEBUGGEE | DEBUG_OUTPUT_DEBUGGEE_PROMPT)
  85. #define OUT_BUFFER_SIZE (1024 * 16)
  86. extern char g_OutBuffer[];
  87. extern char g_FormatBuffer[];
  88. extern char g_OutFilterPattern[MAX_IMAGE_PATH];
  89. extern BOOL g_OutFilterResult;
  90. // Bitwise-OR of all client's output masks for
  91. // quick rejection of output that nobody cares about.
  92. extern ULONG g_AllOutMask;
  93. struct OutHistoryEntryHeader
  94. {
  95. ULONG Mask;
  96. };
  97. typedef OutHistoryEntryHeader UNALIGNED* OutHistoryEntry;
  98. extern PSTR g_OutHistory;
  99. extern ULONG g_OutHistoryActualSize;
  100. extern ULONG g_OutHistoryRequestedSize;
  101. extern OutHistoryEntry g_OutHistRead, g_OutHistWrite;
  102. extern ULONG g_OutHistoryMask;
  103. extern ULONG g_OutHistoryUsed;
  104. struct OutCtlSave
  105. {
  106. ULONG OutputControl;
  107. DebugClient* Client;
  108. BOOL BufferOutput;
  109. ULONG OutputWidth;
  110. PCSTR OutputLinePrefix;
  111. };
  112. extern ULONG g_OutputControl;
  113. extern DebugClient* g_OutputClient;
  114. extern BOOL g_BufferOutput;
  115. void CollectOutMasks(void);
  116. BOOL PushOutCtl(ULONG OutputControl, DebugClient* Client,
  117. OutCtlSave* Save);
  118. void PopOutCtl(OutCtlSave* Save);
  119. void FlushCallbacks(void);
  120. void TimedFlushCallbacks(void);
  121. void SendOutputHistory(DebugClient* Client, ULONG HistoryLimit);
  122. #define OUT_LINE_DEFAULT 0x00000000
  123. #define OUT_LINE_NO_PREFIX 0x00000001
  124. #define OUT_LINE_NO_TIMESTAMP 0x00000002
  125. void StartOutLine(ULONG Mask, ULONG Flags);
  126. BOOL TranslateFormat(LPSTR formatOut, LPCSTR format,
  127. va_list args, ULONG formatOutSize);
  128. void MaskOutVa(ULONG Mask, PCSTR Format, va_list Args, BOOL Translate);
  129. void __cdecl dprintf(PCSTR, ...);
  130. void __cdecl dprintf64(PCSTR, ...);
  131. void __cdecl ErrOut(PCSTR, ...);
  132. void __cdecl WarnOut(PCSTR, ...);
  133. void __cdecl MaskOut(ULONG, PCSTR, ...);
  134. void __cdecl VerbOut(PCSTR, ...);
  135. void __cdecl BpOut(PCSTR, ...);
  136. void __cdecl EventOut(PCSTR, ...);
  137. void __cdecl KdOut(PCSTR, ...);
  138. #endif // #ifndef __CALLBACK_H__