ReactOS  0.4.15-dev-4916-gd519b11
kdb.h
Go to the documentation of this file.
1 #pragma once
2 #include "internal/kd.h"
3 
4 /* TYPES *********************************************************************/
5 
6 /* from kdb.c */
8 
9 typedef enum _KDB_BREAKPOINT_TYPE
10 {
16 
17 typedef enum _KDB_ACCESS_TYPE
18 {
24 
25 typedef struct _KDB_BREAKPOINT
26 {
27  KDB_BREAKPOINT_TYPE Type; /* Type of breakpoint */
28  BOOLEAN Enabled; /* Whether the bp is enabled */
29  ULONG_PTR Address; /* Address of the breakpoint */
30  BOOLEAN Global; /* Whether the breakpoint is global or local to a process */
31  PEPROCESS Process; /* Owning process */
34  union {
35  /* KdbBreakPointSoftware */
37  /* KdbBreakPointHardware */
38  struct {
40  UCHAR Size : 3;
42  } Hw;
43  } Data;
45 
47 {
53 
54 /* These values MUST be nonzero. They're used as bit masks. */
56 {
60 
61 /* FUNCTIONS *****************************************************************/
62 
63 /* from i386/i386-dis.c */
64 
65 LONG
68  IN ULONG IntelSyntax);
69 
70 LONG
73 
74 /* from i386/kdb_help.S */
75 
76 VOID NTAPI
78  IN PVOID NewStack,
79  IN VOID (*Function)(VOID));
80 
81 /* from kdb_cli.c */
82 
84 
85 BOOLEAN
86 NTAPI
89  BOOLEAN Deregister);
90 
91 VOID
93 
94 VOID
96  IN BOOLEAN EnteredOnSingleStep);
97 
98 VOID
100 
101 VOID
102 KdbpPrint(
103  IN PCHAR Format,
104  IN ... OPTIONAL);
105 
106 VOID
109 
110 BOOLEAN
111 NTAPI
113  IN PCHAR pszNum,
114  OUT ULONG_PTR *pulValue);
115 
116 /* from kdb_expr.c */
117 
118 BOOLEAN
121  IN PKDB_KTRAP_FRAME TrapFrame,
123  OUT PLONG ErrOffset OPTIONAL,
124  OUT PCHAR ErrMsg OPTIONAL);
125 
126 PVOID
129  OUT PLONG ErrOffset OPTIONAL,
130  OUT PCHAR ErrMsg OPTIONAL);
131 
132 BOOLEAN
135  IN PKDB_KTRAP_FRAME TrapFrame,
137  OUT PLONG ErrOffset OPTIONAL,
138  OUT PCHAR ErrMsg OPTIONAL);
139 
140 /* from kdb_symbols.c */
141 
142 BOOLEAN
146  OUT PLDR_DATA_TABLE_ENTRY* pLdrEntry);
147 
148 BOOLEAN
150  IN PVOID Address,
152 );
153 
154 VOID
157  _In_ BOOLEAN Load);
158 
159 /* from kdb.c */
160 
164 extern ULONG KdbNumSingleSteps;
167 extern ULONG KdbDebugState;
168 
169 LONG
172 
173 BOOLEAN
175  IN ULONG BreakPointNr,
179  OUT KDB_ACCESS_TYPE *AccessType OPTIONAL,
180  OUT UCHAR *DebugReg OPTIONAL,
184  OUT PCHAR *ConditionExpression OPTIONAL);
185 
186 NTSTATUS
191  IN KDB_ACCESS_TYPE AccessType OPTIONAL,
192  IN PCHAR ConditionExpression OPTIONAL,
193  IN BOOLEAN Global,
194  OUT PLONG BreakPointNr OPTIONAL);
195 
196 BOOLEAN
198  IN LONG BreakPointNr OPTIONAL,
199  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
200 
201 BOOLEAN
203  IN LONG BreakPointNr OPTIONAL,
204  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
205 
206 BOOLEAN
208  IN LONG BreakPointNr OPTIONAL,
209  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
210 
211 BOOLEAN
213  IN LONG ExceptionNr,
214  IN BOOLEAN FirstChance,
216 
217 BOOLEAN
219  IN LONG ExceptionNr,
220  IN BOOLEAN FirstChance,
222 
223 BOOLEAN
225  PVOID ThreadId);
226 
227 BOOLEAN
229  PVOID ProcessId);
230 
231 VOID
232 NTAPI
234 
235 KD_CONTINUE_TYPE
239  IN BOOLEAN FirstChance);
240 
241 KD_CONTINUE_TYPE
243  IN OUT PKTRAP_FRAME TrapFrame);
244 
245 /* other functions */
246 
247 NTSTATUS
249  IN PVOID Src,
250  IN ULONG Bytes);
251 
252 NTSTATUS
254  IN PVOID Src,
255  IN ULONG Bytes);
256 
257 #define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
258 CHAR
260 
261 #define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
262 CHAR
264 
265 VOID
267 
268 VOID
BOOLEAN KdbSingleStepOver
Definition: kdb.c:51
signed char * PCHAR
Definition: retypes.h:7
KDB_ACCESS_TYPE AccessType
Definition: kdb.h:41
PETHREAD KdbCurrentThread
Definition: kdb.c:56
#define IN
Definition: typedefs.h:39
PCWSTR Expression
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2709
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
Definition: kdb.c:1039
PVOID KdbpRpnParseExpression(IN PCHAR Expression, OUT PLONG ErrOffset OPTIONAL, OUT PCHAR ErrMsg OPTIONAL)
Parses the given expression and returns a "handle" to it.
Definition: kdb_expr.c:1142
NTSTATUS KdbpInsertBreakPoint(IN ULONG_PTR Address, IN KDB_BREAKPOINT_TYPE Type, IN UCHAR Size OPTIONAL, IN KDB_ACCESS_TYPE AccessType OPTIONAL, IN PCHAR ConditionExpression OPTIONAL, IN BOOLEAN Global, OUT PLONG BreakPointNr OPTIONAL)
Inserts a breakpoint into the breakpoint array.
Definition: kdb.c:480
ULONG ScanCode
Definition: api.c:39
UCHAR DebugReg
Definition: kdb.h:39
_In_ CDROM_SCAN_FOR_SPECIAL_INFO _In_ PCDROM_SCAN_FOR_SPECIAL_HANDLER Function
Definition: cdrom.h:1154
BOOLEAN KdbSymPrintAddress(IN PVOID Address, IN PCONTEXT Context)
Print address...
Definition: kdb_symbols.c:148
#define _Inout_
Definition: ms_sal.h:378
BOOLEAN Global
Definition: kdb.h:30
CONTEXT KDB_KTRAP_FRAME
Definition: kdb.h:7
char CHAR
Definition: xmlstorage.h:175
struct _KDB_BREAKPOINT::@1765::@1766 Hw
PCHAR ConditionExpression
Definition: kdb.h:32
LONG NTSTATUS
Definition: precomp.h:26
_In_ UINT Bytes
Definition: mmcopy.h:9
VOID KdbpPrintUnicodeString(_In_ PCUNICODE_STRING String)
Definition: kdb_cli.c:3031
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UCHAR Size
Definition: kdb.h:40
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
Definition: kdb_cli.c:3872
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
Definition: kdb.c:871
UNICODE_STRING Global
Definition: symlink.c:37
int32_t INT
Definition: typedefs.h:58
BOOLEAN NTAPI KdbpGetHexNumber(IN PCHAR pszNum, OUT ULONG_PTR *pulValue)
Definition: kdb_cli.c:468
CHAR KdbpTryGetCharSerial(ULONG Retry)
Definition: kdb_serial.c:19
CHAR KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry)
Definition: kdb_keyboard.c:104
VOID KdbSymProcessSymbols(_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry, _In_ BOOLEAN Load)
Load symbols from image mapping. If this fails,.
Definition: kdb_symbols.c:298
BOOLEAN KdbpEnableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Enables a breakpoint.
Definition: kdb.c:704
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _KDB_BREAKPOINT KDB_BREAKPOINT
VOID NTAPI KdbpStackSwitchAndCall(IN PVOID NewStack, IN VOID(*Function)(VOID))
BOOLEAN KdbpGetBreakPointInfo(IN ULONG BreakPointNr, OUT ULONG_PTR *Address OPTIONAL, OUT KDB_BREAKPOINT_TYPE *Type OPTIONAL, OUT UCHAR *Size OPTIONAL, OUT KDB_ACCESS_TYPE *AccessType OPTIONAL, OUT UCHAR *DebugReg OPTIONAL, OUT BOOLEAN *Enabled OPTIONAL, OUT BOOLEAN *Global OPTIONAL, OUT PEPROCESS *Process OPTIONAL, OUT PCHAR *ConditionExpression OPTIONAL)
Returns information of the specified breakpoint.
Definition: kdb.c:411
_KDB_OUTPUT_SETTINGS
Definition: kdb.h:55
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2430
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
VOID NTAPI KdbpGetCommandLineSettings(PCHAR p1)
Definition: kdb.c:1660
BOOLEAN KdbpSetEnterCondition(IN LONG ExceptionNr, IN BOOLEAN FirstChance, IN KDB_ENTER_CONDITION Condition)
Sets the first or last chance enter-condition for exception nr. ExceptionNr.
Definition: kdb.c:998
long LONG
Definition: pedump.c:60
unsigned char BOOLEAN
ULONG KdbNumSingleSteps
Definition: kdb.c:50
static WCHAR Address[46]
Definition: ping.c:68
BOOLEAN KdbpDeleteBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Deletes a breakpoint.
Definition: kdb.c:601
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define _In_
Definition: ms_sal.h:308
KD_CONTINUE_TYPE KdbEnterDebuggerFirstChanceException(IN OUT PKTRAP_FRAME TrapFrame)
Definition: kdb.c:1627
VOID KbdEnableMouse(VOID)
ULONG_PTR Address
Definition: kdb.h:29
PVOID Condition
Definition: kdb.h:33
IN ULONG IN UCHAR Condition
struct _KDB_BREAKPOINT * PKDB_BREAKPOINT
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
Definition: kdb_cli.c:3809
CONTEXT * PKDB_KTRAP_FRAME
Definition: kdb.h:7
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
Definition: kdb.c:1120
_In_ WDFCOLLECTION _In_ ULONG Index
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
Definition: kdb_symbols.c:75
VOID KdbpPrint(IN PCHAR Format, IN ... OPTIONAL)
Prints the given string with printf-like formatting.
Definition: kdb_cli.c:2801
VOID KbdDisableMouse(VOID)
Type
Definition: Type.h:6
LONG KdbpGetInstLength(IN ULONG_PTR Address)
Definition: i386-dis.c:95
KD_CONTINUE_TYPE KdbEnterDebuggerException(IN PEXCEPTION_RECORD64 ExceptionRecord, IN KPROCESSOR_MODE PreviousMode, IN OUT PCONTEXT Context, IN BOOLEAN FirstChance)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
Definition: partlist.h:33
_KDB_ENTER_CONDITION
Definition: kdb.h:46
enum _KDB_ACCESS_TYPE KDB_ACCESS_TYPE
enum _KDB_OUTPUT_SETTINGS KDB_OUTPUT_SETTINGS
unsigned char UCHAR
Definition: xmlstorage.h:181
_In_ PSCSI_REQUEST_BLOCK _Out_ NTSTATUS _Inout_ BOOLEAN * Retry
Definition: classpnp.h:310
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
_KDB_BREAKPOINT_TYPE
Definition: kdb.h:9
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
Definition: kdb.c:58
Definition: btrfs_drv.h:1866
LONG KdbpDisassemble(IN ULONG_PTR Address, IN ULONG IntelSyntax)
Definition: i386-dis.c:125
enum _KDB_BREAKPOINT_TYPE KDB_BREAKPOINT_TYPE
union _KDB_BREAKPOINT::@1765 Data
BOOLEAN KdbpRpnEvaluateParsedExpression(IN PVOID Expression, IN PKDB_KTRAP_FRAME TrapFrame, OUT PULONGLONG Result, OUT PLONG ErrOffset OPTIONAL, OUT PCHAR ErrMsg OPTIONAL)
Evaluates the given expression and returns the result.
Definition: kdb_expr.c:1196
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
PEPROCESS Process
Definition: kdb.h:31
UCHAR SavedInstruction
Definition: kdb.h:36
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
Definition: kdb.c:384
VOID KdbpCliInit(VOID)
Called when KDB is initialized.
Definition: kdb_cli.c:3921
ULONG KdbDebugState
Definition: kdb.c:52
unsigned int * PULONG
Definition: retypes.h:1
LONG KdbLastBreakPointNr
Definition: kdb.c:49
PEPROCESS KdbCurrentProcess
Definition: kdb.c:54
BOOLEAN KdbpGetEnterCondition(IN LONG ExceptionNr, IN BOOLEAN FirstChance, OUT KDB_ENTER_CONDITION *Condition)
Gets the first or last chance enter-condition for exception nr. ExceptionNr.
Definition: kdb.c:976
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define OUT
Definition: typedefs.h:40
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:383
NTSTATUS KdbpSafeReadMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
Definition: kdb.c:1690
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
Definition: kdb_cli.c:3666
BOOLEAN Enabled
Definition: kdb.h:28
_KDB_ACCESS_TYPE
Definition: kdb.h:17
KDB_BREAKPOINT_TYPE Type
Definition: kdb.h:27
NTSTATUS KdbpSafeWriteMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
Definition: kdb.c:1704
signed int * PLONG
Definition: retypes.h:5
BOOLEAN KdbpRpnEvaluateExpression(IN PCHAR Expression, IN PKDB_KTRAP_FRAME TrapFrame, OUT PULONGLONG Result, OUT PLONG ErrOffset OPTIONAL, OUT PCHAR ErrMsg OPTIONAL)
Evaluates the given expression.
Definition: kdb_expr.c:1102
PCHAR KdbInitFileBuffer
Definition: kdb_cli.c:155
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68