- Add kdbreak.c with the following APIs: KdpLowWriteContent, KdpLowRestoreBreakpoint...
[reactos.git] / reactos / ntoskrnl / include / internal / kd.h
1 typedef struct _BREAKPOINT_ENTRY
2 {
3 ULONG Flags;
4 PKPROCESS Process;
5 PVOID Address;
6 UCHAR Content;
7 } BREAKPOINT_ENTRY, *PBREAKPOINT_ENTRY;
8
9 typedef enum _KDP_BREAKPOINT_FLAGS
10 {
11 KdpBreakpointActive = 1,
12 KdpBreakpointPending = 2,
13 KdpBreakpointSuspended = 4,
14 KdpBreakpointExpired = 8
15 } KDP_BREAKPOINT_FLAGS;
16
17 typedef
18 BOOLEAN
19 (NTAPI *PKDEBUG_ROUTINE)(
20 IN PKTRAP_FRAME TrapFrame,
21 IN PKEXCEPTION_FRAME ExceptionFrame,
22 IN PEXCEPTION_RECORD ExceptionRecord,
23 IN PCONTEXT Context,
24 IN KPROCESSOR_MODE PreviousMode,
25 IN BOOLEAN SecondChance
26 );
27
28 typedef
29 BOOLEAN
30 (NTAPI *PKDEBUG_SWITCH_ROUTINE)(
31 IN PEXCEPTION_RECORD ExceptionRecord,
32 IN PCONTEXT Context,
33 IN BOOLEAN SecondChance
34 );
35
36 BOOLEAN
37 NTAPI
38 KdpEnterDebuggerException(
39 IN PKTRAP_FRAME TrapFrame,
40 IN PKEXCEPTION_FRAME ExceptionFrame,
41 IN PEXCEPTION_RECORD ExceptionRecord,
42 IN PCONTEXT Context,
43 IN KPROCESSOR_MODE PreviousMode,
44 IN BOOLEAN SecondChance
45 );
46
47 VOID
48 NTAPI
49 KdpTimeSlipWork(
50 IN PVOID Context
51 );
52
53 BOOLEAN
54 NTAPI
55 KdpSwitchProcessor(
56 IN PEXCEPTION_RECORD ExceptionRecord,
57 IN OUT PCONTEXT ContextRecord,
58 IN BOOLEAN SecondChanceException
59 );
60
61 VOID
62 NTAPI
63 KdpTimeSlipDpcRoutine(
64 IN PKDPC Dpc,
65 IN PVOID DeferredContext,
66 IN PVOID SystemArgument1,
67 IN PVOID SystemArgument2
68 );
69
70 BOOLEAN
71 NTAPI
72 KdpStub(
73 IN PKTRAP_FRAME TrapFrame,
74 IN PKEXCEPTION_FRAME ExceptionFrame,
75 IN PEXCEPTION_RECORD ExceptionRecord,
76 IN PCONTEXT ContextRecord,
77 IN KPROCESSOR_MODE PreviousMode,
78 IN BOOLEAN SecondChanceException
79 );
80
81 BOOLEAN
82 NTAPI
83 KdpTrap(
84 IN PKTRAP_FRAME TrapFrame,
85 IN PKEXCEPTION_FRAME ExceptionFrame,
86 IN PEXCEPTION_RECORD ExceptionRecord,
87 IN PCONTEXT ContextRecord,
88 IN KPROCESSOR_MODE PreviousMode,
89 IN BOOLEAN SecondChanceException
90 );
91
92 VOID
93 NTAPI
94 KdpPortLock(
95 VOID
96 );
97
98 VOID
99 NTAPI
100 KdpPortUnlock(
101 VOID
102 );
103
104 BOOLEAN
105 NTAPI
106 KdEnterDebugger(
107 IN PKTRAP_FRAME TrapFrame,
108 IN PKEXCEPTION_FRAME ExceptionFrame
109 );
110
111 VOID
112 NTAPI
113 KdExitDebugger(
114 IN BOOLEAN Entered
115 );
116
117 NTSTATUS
118 NTAPI
119 KdEnableDebuggerWithLock(
120 IN BOOLEAN NeedLock
121 );
122
123 ULONG
124 NTAPI
125 KdpPrint(
126 IN ULONG ComponentId,
127 IN ULONG ComponentMask,
128 IN LPSTR String,
129 IN ULONG Length,
130 IN KPROCESSOR_MODE PreviousMode,
131 IN PKTRAP_FRAME TrapFrame,
132 IN PKEXCEPTION_FRAME ExceptionFrame,
133 OUT PBOOLEAN Status
134 );
135
136 ULONG
137 NTAPI
138 KdpSymbol(
139 IN PSTRING DllPath,
140 IN PKD_SYMBOLS_INFO DllBase,
141 IN BOOLEAN Unload,
142 IN KPROCESSOR_MODE PreviousMode,
143 IN PCONTEXT ContextRecord,
144 IN PKTRAP_FRAME TrapFrame,
145 IN PKEXCEPTION_FRAME ExceptionFrame
146 );
147
148 BOOLEAN
149 NTAPI
150 KdpPollBreakInWithPortLock(
151 VOID
152 );
153
154 BOOLEAN
155 NTAPI
156 KdpReportLoadSymbolsStateChange(
157 IN PSTRING PathName,
158 IN PKD_SYMBOLS_INFO SymbolInfo,
159 IN BOOLEAN Unload,
160 IN OUT PCONTEXT Context
161 );
162
163 VOID
164 NTAPI
165 KdpRestoreAllBreakpoints(
166 VOID
167 );
168
169 BOOLEAN
170 NTAPI
171 KdpDeleteBreakpoint(
172 IN ULONG BpEntry
173 );
174
175 extern DBGKD_GET_VERSION64 KdVersionBlock;
176 extern KDDEBUGGER_DATA64 KdDebuggerDataBlock;
177 extern LIST_ENTRY KdpDebuggerDataListHead;
178 extern KSPIN_LOCK KdpDataSpinLock;
179 extern LARGE_INTEGER KdPerformanceCounterRate;
180 extern LARGE_INTEGER KdTimerStart;
181 extern ULONG KdDisableCount;
182 extern KD_CONTEXT KdpContext;
183 extern PKDEBUG_ROUTINE KiDebugRoutine;
184 extern PKDEBUG_SWITCH_ROUTINE KiDebugSwitchRoutine;
185 extern BOOLEAN KdBreakAfterSymbolLoad;
186 extern BOOLEAN KdPitchDebugger;
187 extern BOOLEAN _KdDebuggerNotPresent;
188 extern BOOLEAN _KdDebuggerEnabled;
189 extern BOOLEAN KdAutoEnableOnEvent;
190 extern BOOLEAN KdPreviouslyEnabled;
191 extern BOOLEAN KdpDebuggerStructuresInitialized;
192 extern BOOLEAN KdEnteredDebugger;
193 extern KDPC KdpTimeSlipDpc;
194 extern KTIMER KdpTimeSlipTimer;
195 extern WORK_QUEUE_ITEM KdpTimeSlipWorkItem;
196 extern LONG KdpTimeSlipPending;
197 extern PKEVENT KdpTimeSlipEvent;
198 extern KSPIN_LOCK KdpTimeSlipEventLock;
199 extern BOOLEAN KdpControlCPressed;
200 extern BOOLEAN KdpControlCWaiting;
201 extern BOOLEAN KdpPortLocked;
202 extern KSPIN_LOCK KdpDebuggerLock;
203 extern LARGE_INTEGER KdTimerStop, KdTimerStart, KdTimerDifference;
204 extern ULONG KdComponentTableSize;
205 extern ULONG Kd_WIN2000_Mask;
206 extern PULONG KdComponentTable[104];
207 extern CHAR KdpMessageBuffer[4096], KdpPathBuffer[4096];
208 extern BREAKPOINT_ENTRY KdpBreakpointTable[20];
209 extern ULONG KdpBreakpointInstruction;
210 extern BOOLEAN KdpOweBreakpoint;
211 extern BOOLEAN BreakpointsSuspended;