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.

118 lines
4.0 KiB

  1. /*
  2. * deb.h - Debug API/events include file
  3. *
  4. * 4/25/93 mikem
  5. */
  6. #define INVALID_ADDRESS ((PVOID)0xfffffbad)
  7. #ifdef DEBUG
  8. #define DER_SIGNATURE_VALUE 0x20524544 // "DER "
  9. #define DEE_SIGNATURE_VALUE 0x20454544 // "DEE "
  10. #define debAssertCreateDER(pder) {(pder)->der_signature = DER_SIGNATURE_VALUE;}
  11. #define debAssertCreateDEE(pdee) {(pdee)->dee_signature = DEE_SIGNATURE_VALUE;}
  12. #define debAssertDestroyDER(pder) {(pder)->der_signature = 0x44414544;}
  13. #define debAssertDestroyDEE(pdee) {(pdee)->dee_signature = 0x44414544;}
  14. #define debAssertSignature(type) ULONG type##_signature;
  15. #define debAssertDER(pder) Assert((pder)->der_signature==DER_SIGNATURE_VALUE)
  16. #define debAssertDEE(pdee) Assert((pdee)->dee_signature==DEE_SIGNATURE_VALUE)
  17. #else
  18. #define debAssertCreateDER(pder)
  19. #define debAssertCreateDEE(pdee)
  20. #define debAssertDestroyDER(pder)
  21. #define debAssertDestroyDEE(pdee)
  22. #define debAssertSignature(type)
  23. #define debAssertDER(pder)
  24. #define debAssertDEE(pdee)
  25. #endif
  26. /* Debugger data block. Pointed to by "tdb_pderDebugger" in the tdb. */
  27. typedef struct _der {
  28. struct _dee *der_pdeeHead; // list of debuggee data blocks - MUST BE FIRST
  29. PTDB der_ptdbDebugger; // the debugger's thread data block
  30. PPDB der_ppdbDebugger; // the debugger's process data block
  31. CRST der_crst; // critical section for protecting DER
  32. PEVT der_pevtDebugger; // debugger's wait event
  33. PEVT der_pevtDebuggee; // debuggee's wait event
  34. DEBUG_EVENT der_de; // debug event block for this debugger
  35. BOOL der_fContinueStatus; // continue status for exception events
  36. CONTEXT der_context; // context record while in an exception
  37. debAssertSignature(der)
  38. } DER;
  39. typedef DER *PDER;
  40. /* Debuggee data block. Pointed to by "pdb_pdeeDebuggee" in the pdb. */
  41. typedef struct _dee {
  42. struct _dee *dee_pdeeNext; // next in list, 0 if end - MUST BE FIRST
  43. PPDB dee_ppdbDebuggee; // pointer to debuggee's process data block
  44. PDER dee_pderDebugger; // pointer to debugger's data block
  45. HANDLE dee_ihteProcess; // debuggee process handle for debugger
  46. DWORD dee_cThreads; // count of threads in process
  47. HANDLE dee_hheapShared; // shared-arena heap for storing thunks
  48. debAssertSignature(dee)
  49. } DEE;
  50. typedef DEE *PDEE;
  51. /* Debug IAT thunk template */
  52. typedef struct _dit {
  53. BYTE dit_pushop; // 0x68
  54. DWORD dit_oldiat; // old iat address
  55. BYTE dit_jmpop; // 0xe9
  56. DWORD dit_relcom; // relative offset to DEBCommonIATThunk
  57. } DIT;
  58. typedef DIT *PDIT;
  59. /* Shared DLL debug entry record */
  60. typedef struct _DEBDLLCONTEXT {
  61. struct _DEBDLLCONTEXT *NextActive; // null terminated active list
  62. struct _DEBDLLCONTEXT *NextFree; // null terminated free list
  63. struct { // exception registration record
  64. PVOID Next;
  65. PVOID Handler;
  66. } ExRegRec;
  67. CONTEXT Context; // context record
  68. } DEBDLLCONTEXT, *PDEBDLLCONTEXT;
  69. /* Shared DLL debug entry record sentinel */
  70. typedef struct _DEBDLLCONTEXTSENTINEL {
  71. struct _DEBDLLCONTEXT *NextActive; // null terminated active list
  72. struct _DEBDLLCONTEXT *NextFree; // null terminated free list
  73. } DEBDLLCONTEXTSENTINEL, *PDEBDLLCONTEXTSENTINEL;
  74. /* Number of initial DEBDLLCONTEXT records per thread */
  75. #define N_INITIAL_DEBDLLRECS 1
  76. VOID __cdecl DEBCommonIATThunk();
  77. VOID __cdecl DEBCommonIATThunkUnwindHandler();
  78. /* Prototypes for internal debug api functions */
  79. BOOL KERNENTRY DEBCreateProcess(DWORD, DWORD, DWORD, PPDB, PTDB);
  80. VOID KERNENTRY DEBExitProcess(PPDB);
  81. BOOL KERNENTRY DEBCreateThread(PTDB, DWORD);
  82. VOID KERNENTRY DEBExitThread(PTDB);
  83. VOID KERNENTRY DEBCreateProcessEvent(PPDB, PTDB, BOOL);
  84. VOID KERNENTRY DEBCreateThreadEvent(PTDB, PVOID);
  85. VOID KERNENTRY DEBExitThreadOrProcessEvent();
  86. BOOL KERNENTRY DEBExceptionEvent(DWORD, ULONG, PEXCEPTION_RECORD, PCONTEXT);
  87. VOID KERNENTRY DEBAttachProcessModules(PTDB, BOOL);
  88. VOID KERNENTRY DEBLoadDLLEvent(PTDB, PVOID, PVOID);
  89. VOID KERNENTRY DEBUnloadDLLEvent(PVOID);
  90. VOID KERNENTRY DEBRipEvent(DWORD, DWORD);
  91. BOOL KERNENTRY DEBMakePrivate(PVOID, ULONG);
  92. PDIT KERNENTRY DEBCreateDIT(HANDLE, DWORD);