ReactOS  0.4.15-dev-5496-g599ba9c
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 KdbpPager(
103  _In_ PCHAR Buffer,
104  _In_ ULONG BufLength);
105 
106 VOID
107 KdbpPrint(
108  _In_ PSTR Format,
109  _In_ ...);
110 
111 VOID
114 
115 BOOLEAN
116 NTAPI
118  IN PCHAR pszNum,
119  OUT ULONG_PTR *pulValue);
120 
121 /* from kdb_expr.c */
122 
123 BOOLEAN
126  IN PKDB_KTRAP_FRAME TrapFrame,
128  OUT PLONG ErrOffset OPTIONAL,
129  OUT PCHAR ErrMsg OPTIONAL);
130 
131 PVOID
134  OUT PLONG ErrOffset OPTIONAL,
135  OUT PCHAR ErrMsg OPTIONAL);
136 
137 BOOLEAN
140  IN PKDB_KTRAP_FRAME TrapFrame,
142  OUT PLONG ErrOffset OPTIONAL,
143  OUT PCHAR ErrMsg OPTIONAL);
144 
145 /* from kdb_symbols.c */
146 
147 BOOLEAN
151  OUT PLDR_DATA_TABLE_ENTRY* pLdrEntry);
152 
153 BOOLEAN
155  IN PVOID Address,
157 );
158 
159 VOID
162  _In_ BOOLEAN Load);
163 
164 /* from kdb.c */
165 
169 extern ULONG KdbNumSingleSteps;
172 extern ULONG KdbDebugState;
173 
174 LONG
177 
178 BOOLEAN
180  IN ULONG BreakPointNr,
184  OUT KDB_ACCESS_TYPE *AccessType OPTIONAL,
185  OUT UCHAR *DebugReg OPTIONAL,
189  OUT PCHAR *ConditionExpression OPTIONAL);
190 
191 NTSTATUS
196  IN KDB_ACCESS_TYPE AccessType OPTIONAL,
197  IN PCHAR ConditionExpression OPTIONAL,
198  IN BOOLEAN Global,
199  OUT PLONG BreakPointNr 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 BreakPointNr OPTIONAL,
214  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
215 
216 BOOLEAN
218  IN LONG ExceptionNr,
219  IN BOOLEAN FirstChance,
221 
222 BOOLEAN
224  IN LONG ExceptionNr,
225  IN BOOLEAN FirstChance,
227 
228 BOOLEAN
230  PVOID ThreadId);
231 
232 BOOLEAN
234  PVOID ProcessId);
235 
236 VOID
237 NTAPI
239 
240 KD_CONTINUE_TYPE
244  IN BOOLEAN FirstChance);
245 
246 KD_CONTINUE_TYPE
248  IN OUT PKTRAP_FRAME TrapFrame);
249 
250 /* other functions */
251 
252 NTSTATUS
254  IN PVOID Src,
255  IN ULONG Bytes);
256 
257 NTSTATUS
259  IN PVOID Src,
260  IN ULONG Bytes);
261 
262 #define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
263 CHAR
265 
266 #define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
267 CHAR
269 
270 VOID
272 
273 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
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
UINT ScanCode
Definition: VirtualKey.c:24
CONTEXT KDB_KTRAP_FRAME
Definition: kdb.h:7
char CHAR
Definition: xmlstorage.h:175
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:3247
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UCHAR Size
Definition: kdb.h:40
union _KDB_BREAKPOINT::@1771 Data
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
Definition: kdb_cli.c:3741
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
Definition: bufpool.h:45
IN ULONG IN UCHAR Condition
struct _KDB_BREAKPOINT * PKDB_BREAKPOINT
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
Definition: kdb_cli.c:3678
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 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
struct _KDB_BREAKPOINT::@1771::@1772 Hw
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:1876
LONG KdbpDisassemble(IN ULONG_PTR Address, IN ULONG IntelSyntax)
Definition: i386-dis.c:125
enum _KDB_BREAKPOINT_TYPE KDB_BREAKPOINT_TYPE
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
VOID KdbpPager(_In_ PCHAR Buffer, _In_ ULONG BufLength)
Prints the given string with, page by page.
Definition: kdb_cli.c:3206
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
signed char * PSTR
Definition: retypes.h:7
VOID KdbpCliInit(VOID)
Called when KDB is initialized.
Definition: kdb_cli.c:3790
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:3535
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
VOID KdbpPrint(_In_ PSTR Format, _In_ ...)
Prints the given string with printf-like formatting.
Definition: kdb_cli.c:3224
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