Little KDB update ;-) If you have any problems and/or questions let me know. I hope...
[reactos.git] / reactos / ntoskrnl / include / internal / kd.h
1 /* $Id$
2 *
3 * kernel debugger prototypes
4 */
5
6 #ifndef __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
7 #define __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H
8
9 #include <internal/ke.h>
10 #include <internal/ldr.h>
11 #include <ntdll/ldr.h>
12
13 #define KD_DEBUG_DISABLED 0x00
14 #define KD_DEBUG_GDB 0x01
15 #define KD_DEBUG_PICE 0x02
16 #define KD_DEBUG_SCREEN 0x04
17 #define KD_DEBUG_SERIAL 0x08
18 #define KD_DEBUG_BOCHS 0x10
19 #define KD_DEBUG_BOOTLOG 0x20
20 #define KD_DEBUG_MDA 0x40
21 #define KD_DEBUG_KDB 0x80
22 #define KD_DEBUG_KDSERIAL 0x100
23 #define KD_DEBUG_KDNOECHO 0x200
24
25 extern ULONG KdDebugState;
26
27 KD_PORT_INFORMATION GdbPortInfo;
28 KD_PORT_INFORMATION LogPortInfo;
29
30 typedef enum _KD_CONTINUE_TYPE
31 {
32 kdContinue = 0,
33 kdDoNotHandleException,
34 kdHandleException
35 } KD_CONTINUE_TYPE;
36
37 VOID
38 KbdDisableMouse();
39
40 VOID
41 KbdEnableMouse();
42
43 ULONG
44 KdpPrintString (PANSI_STRING String);
45
46 VOID
47 DebugLogWrite(PCH String);
48 VOID
49 DebugLogInit(VOID);
50 VOID
51 DebugLogInit2(VOID);
52
53 VOID
54 STDCALL
55 KdDisableDebugger(
56 VOID
57 );
58
59 VOID
60 STDCALL
61 KdEnableDebugger(
62 VOID
63 );
64
65 NTSTATUS
66 STDCALL
67 KdPowerTransition(
68 ULONG PowerState
69 );
70
71 BOOLEAN
72 STDCALL
73 KeIsAttachedProcess(
74 VOID
75 );
76
77 VOID
78 KdInit1(VOID);
79
80 VOID
81 KdInit2(VOID);
82
83 VOID
84 KdInit3(VOID);
85
86 VOID
87 KdPutChar(UCHAR Value);
88
89 UCHAR
90 KdGetChar(VOID);
91
92 VOID
93 KdGdbStubInit(ULONG Phase);
94
95 VOID
96 KdGdbDebugPrint (LPSTR Message);
97
98 VOID
99 KdDebugPrint (LPSTR Message);
100
101 KD_CONTINUE_TYPE
102 KdEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
103 PCONTEXT Context,
104 PKTRAP_FRAME TrapFrame);
105 VOID KdInitializeMda(VOID);
106 VOID KdPrintMda(PCH pch);
107
108 #if !defined(KDBG) && !defined(DBG)
109 # define KDB_LOADUSERMODULE_HOOK(LDRMOD) do { } while (0)
110 # define KDB_DELETEPROCESS_HOOK(PROCESS) do { } while (0)
111 # define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) do { } while (0)
112 # define KDB_UNLOADDRIVER_HOOK(MODULE) do { } while (0)
113 # define KDB_LOADERINIT_HOOK(NTOS, HAL) do { } while (0)
114 # define KDB_SYMBOLFILE_HOOK(FILENAME) do { } while (0)
115 # define KDB_CREATE_THREAD_HOOK(CONTEXT) do { } while (0)
116 #else
117 # define KDB_LOADUSERMODULE_HOOK(LDRMOD) KdbSymLoadUserModuleSymbols(LDRMOD)
118 # define KDB_DELETEPROCESS_HOOK(PROCESS) KdbDeleteProcessHook(PROCESS)
119 # define KDB_LOADDRIVER_HOOK(FILENAME, MODULE) KdbSymLoadDriverSymbols(FILENAME, MODULE)
120 # define KDB_UNLOADDRIVER_HOOK(MODULE) KdbSymUnloadDriverSymbols(MODULE)
121 # define KDB_LOADERINIT_HOOK(NTOS, HAL) KdbSymInit(NTOS, HAL)
122 # define KDB_SYMBOLFILE_HOOK(FILENAME) KdbSymProcessBootSymbols(FILENAME)
123 /*#define KDB_CREATE_THREAD_HOOK(CONTEXT) \
124 KdbCreateThreadHook(CONTEXT)
125 */
126 VOID
127 KdbDeleteProcessHook(IN PEPROCESS Process);
128
129 VOID
130 KdbSymLoadUserModuleSymbols(IN PLDR_MODULE LdrModule);
131
132 VOID
133 KdbSymFreeProcessSymbols(IN PEPROCESS Process);
134
135 VOID
136 KdbSymLoadDriverSymbols(IN PUNICODE_STRING Filename,
137 IN PMODULE_OBJECT Module);
138
139 VOID
140 KdbSymUnloadDriverSymbols(IN PMODULE_OBJECT ModuleObject);
141
142 VOID
143 KdbSymProcessBootSymbols(IN PCHAR FileName);
144
145 VOID
146 KdbSymInit(IN PMODULE_TEXT_SECTION NtoskrnlTextSection,
147 IN PMODULE_TEXT_SECTION LdrHalTextSection);
148
149
150 BOOLEAN
151 KdbSymPrintAddress(IN PVOID Address);
152
153 KD_CONTINUE_TYPE
154 KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
155 KPROCESSOR_MODE PreviousMode,
156 PCONTEXT Context,
157 PKTRAP_FRAME TrapFrame,
158 BOOLEAN FirstChance);
159
160 #endif /* KDBG || DBG */
161
162 VOID
163 DebugLogDumpMessages(VOID);
164
165 #endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */