ReactOS  0.4.14-dev-1112-g2b067d6
kdb.h
Go to the documentation of this file.
1 #pragma once
2 #include "internal/kd.h"
3 
4 /* DEFINES *******************************************************************/
5 
6 /* formerly located in kdbg/kdb_symbols.c */
7 #define TAG_KDBS 'SBDK'
8 #define TAG_KDBG 'GBDK'
9 
10 /* TYPES *********************************************************************/
11 
12 /* from kdb.c */
13 typedef struct _KDB_KTRAP_FRAME
14 {
17  ULONG Cr1; /* reserved/unused */
22 
24 {
30 
31 typedef enum _KDB_ACCESS_TYPE
32 {
38 
39 typedef struct _KDB_BREAKPOINT
40 {
41  KDB_BREAKPOINT_TYPE Type; /* Type of breakpoint */
42  BOOLEAN Enabled; /* Whether the bp is enabled */
43  ULONG_PTR Address; /* Address of the breakpoint */
44  BOOLEAN Global; /* Whether the breakpoint is global or local to a process */
45  PEPROCESS Process; /* Owning process */
48  union {
49  /* KdbBreakPointSoftware */
51  /* KdbBreakPointHardware */
52  struct {
54  UCHAR Size : 3;
56  } Hw;
57  } Data;
59 
61 {
67 
68 /* These values MUST be nonzero. They're used as bit masks. */
70 {
74 
75 /* FUNCTIONS *****************************************************************/
76 
77 /* from i386/i386-dis.c */
78 
79 LONG
82  IN ULONG IntelSyntax);
83 
84 LONG
86  IN ULONG Address);
87 
88 /* from i386/kdb_help.S */
89 
90 VOID NTAPI
92  IN PVOID NewStack,
93  IN VOID (*Function)(VOID));
94 
95 /* from kdb_cli.c */
96 
98 
99 VOID
101 
102 VOID
104  IN BOOLEAN EnteredOnSingleStep);
105 
106 VOID
109 
110 VOID
112 
113 VOID
114 KdbpPrint(
115  IN PCHAR Format,
116  IN ... OPTIONAL);
117 
118 BOOLEAN
119 NTAPI
121  IN PCHAR pszNum,
122  OUT ULONG_PTR *pulValue);
123 
124 /* from kdb_expr.c */
125 
126 BOOLEAN
129  IN PKDB_KTRAP_FRAME TrapFrame,
131  OUT PLONG ErrOffset OPTIONAL,
132  OUT PCHAR ErrMsg OPTIONAL);
133 
134 PVOID
137  OUT PLONG ErrOffset OPTIONAL,
138  OUT PCHAR ErrMsg OPTIONAL);
139 
140 BOOLEAN
143  IN PKDB_KTRAP_FRAME TrapFrame,
145  OUT PLONG ErrOffset OPTIONAL,
146  OUT PCHAR ErrMsg OPTIONAL);
147 
148 /* from kdb_symbols.c */
149 
150 BOOLEAN
155  OUT PLDR_DATA_TABLE_ENTRY* pLdrEntry);
156 
157 /* from kdb.c */
158 
162 extern ULONG KdbNumSingleSteps;
165 extern ULONG KdbDebugState;
166 
167 LONG
170 
171 BOOLEAN
173  IN ULONG BreakPointNr,
177  OUT KDB_ACCESS_TYPE *AccessType OPTIONAL,
178  OUT UCHAR *DebugReg OPTIONAL,
182  OUT PCHAR *ConditionExpression OPTIONAL);
183 
184 NTSTATUS
189  IN KDB_ACCESS_TYPE AccessType OPTIONAL,
190  IN PCHAR ConditionExpression OPTIONAL,
191  IN BOOLEAN Global,
192  OUT PLONG BreakPointNr OPTIONAL);
193 
194 BOOLEAN
196  IN LONG BreakPointNr OPTIONAL,
197  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
198 
199 BOOLEAN
201  IN LONG BreakPointNr OPTIONAL,
202  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
203 
204 BOOLEAN
206  IN LONG BreakPointNr OPTIONAL,
207  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
208 
209 BOOLEAN
211  IN LONG ExceptionNr,
212  IN BOOLEAN FirstChance,
214 
215 BOOLEAN
217  IN LONG ExceptionNr,
218  IN BOOLEAN FirstChance,
220 
221 BOOLEAN
223  PVOID ThreadId);
224 
225 BOOLEAN
227  PVOID ProcessId);
228 
229 VOID
230 NTAPI
232 
233 KD_CONTINUE_TYPE
237  PKTRAP_FRAME TrapFrame,
238  BOOLEAN FirstChance);
239 /* other functions */
240 
241 NTSTATUS
243  IN PVOID Src,
244  IN ULONG Bytes);
245 
246 NTSTATUS
248  IN PVOID Src,
249  IN ULONG Bytes);
250 
251 #define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
252 CHAR
254 
255 #define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
256 CHAR
258 
259 VOID
260 KdbEnter(VOID);
261 VOID
263 VOID
265 VOID
267 VOID
269 VOID
271 VOID
BOOLEAN KdbSingleStepOver
Definition: kdb.c:44
signed char * PCHAR
Definition: retypes.h:7
KDB_ACCESS_TYPE AccessType
Definition: kdb.h:55
ULONG Cr3
Definition: kdb.h:19
PETHREAD KdbCurrentThread
Definition: kdb.c:49
#define IN
Definition: typedefs.h:39
PCWSTR Expression
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2697
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
Definition: kdb.c:1092
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:1131
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:533
LONG KdbpGetInstLength(IN ULONG Address)
Definition: i386-dis.c:97
ULONG ScanCode
Definition: api.c:39
UCHAR DebugReg
Definition: kdb.h:53
Type
Definition: Type.h:6
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
VOID KdbEnter(VOID)
BOOLEAN Global
Definition: kdb.h:44
ULONG Cr4
Definition: kdb.h:20
char CHAR
Definition: xmlstorage.h:175
PCHAR ConditionExpression
Definition: kdb.h:46
LONG NTSTATUS
Definition: precomp.h:26
_In_ UINT Bytes
Definition: mmcopy.h:9
UCHAR Size
Definition: kdb.h:54
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
Definition: kdb_cli.c:3719
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
Definition: kdb.c:924
UNICODE_STRING Global
Definition: symlink.c:37
int32_t INT
Definition: typedefs.h:57
BOOLEAN NTAPI KdbpGetHexNumber(IN PCHAR pszNum, OUT ULONG_PTR *pulValue)
Definition: kdb_cli.c:416
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:925
CHAR KdbpTryGetCharSerial(ULONG Retry)
Definition: kdb_serial.c:19
CHAR KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry)
Definition: kdb_keyboard.c:104
BOOLEAN KdbpEnableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Enables a breakpoint.
Definition: kdb.c:757
uint32_t ULONG_PTR
Definition: typedefs.h:64
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:464
struct _KDB_BREAKPOINT::@1762::@1763 Hw
_KDB_OUTPUT_SETTINGS
Definition: kdb.h:69
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static LPOVERLAPPED_COMPLETION_ROUTINE Function
Definition: sync.c:684
VOID NTAPI KdbpGetCommandLineSettings(PCHAR p1)
Definition: kdb.c:1697
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:1051
long LONG
Definition: pedump.c:60
KD_CONTINUE_TYPE KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, KPROCESSOR_MODE PreviousMode, PCONTEXT Context, PKTRAP_FRAME TrapFrame, BOOLEAN FirstChance)
CHAR * PCH
Definition: ntbasedef.h:398
unsigned char BOOLEAN
ULONG KdbNumSingleSteps
Definition: kdb.c:43
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:654
_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
VOID KbdEnableMouse(VOID)
ULONG_PTR Address
Definition: kdb.h:43
IN PSCSI_REQUEST_BLOCK IN OUT NTSTATUS IN OUT BOOLEAN * Retry
Definition: class2.h:49
PVOID Condition
Definition: kdb.h:47
IN ULONG IN UCHAR Condition
struct _KDB_BREAKPOINT * PKDB_BREAKPOINT
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
Definition: kdb_cli.c:3641
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
Definition: kdb.c:1173
ULONG Cr1
Definition: kdb.h:17
VOID KdbpPrint(IN PCHAR Format, IN ... OPTIONAL)
Prints the given string with printf-like formatting.
Definition: kdb_cli.c:2651
static const UCHAR Index[8]
Definition: usbohci.c:18
VOID KbdDisableMouse(VOID)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
VOID DbgDisableFile(PCH Filename)
Definition: partlist.h:33
_KDB_ENTER_CONDITION
Definition: kdb.h:60
enum _KDB_ACCESS_TYPE KDB_ACCESS_TYPE
enum _KDB_OUTPUT_SETTINGS KDB_OUTPUT_SETTINGS
unsigned char UCHAR
Definition: xmlstorage.h:181
LONG KdbpDisassemble(IN ULONG Address, IN ULONG IntelSyntax)
Definition: i386-dis.c:123
VOID DbgEnableFile(PCH Filename)
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
_KDB_BREAKPOINT_TYPE
Definition: kdb.h:23
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
Definition: kdb.c:51
Definition: btrfs_drv.h:1853
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
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:1185
struct _KDB_KTRAP_FRAME * PKDB_KTRAP_FRAME
PEPROCESS Process
Definition: kdb.h:45
ULONG Cr0
Definition: kdb.h:16
UCHAR SavedInstruction
Definition: kdb.h:50
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
Definition: kdb.c:437
VOID DbgRDebugInit(VOID)
KTRAP_FRAME Tf
Definition: kdb.h:15
union _KDB_BREAKPOINT::@1762 Data
struct _KDB_KTRAP_FRAME KDB_KTRAP_FRAME
VOID KdbpCliInit(VOID)
Called when KDB is initialized.
Definition: kdb_cli.c:3768
ULONG KdbDebugState
Definition: kdb.c:45
unsigned int * PULONG
Definition: retypes.h:1
LONG KdbLastBreakPointNr
Definition: kdb.c:42
PEPROCESS KdbCurrentProcess
Definition: kdb.c:47
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:1029
VOID KdbpCliModuleLoaded(IN PUNICODE_STRING Name)
Called when a module is loaded.
Definition: kdb_cli.c:3702
_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:390
NTSTATUS KdbpSafeReadMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
Definition: kdb.c:1727
VOID DbgShowFiles(VOID)
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN Enabled
Definition: kdb.h:42
_KDB_ACCESS_TYPE
Definition: kdb.h:31
ULONG Cr2
Definition: kdb.h:18
KDB_BREAKPOINT_TYPE Type
Definition: kdb.h:41
NTSTATUS KdbpSafeWriteMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
Definition: kdb.c:1741
signed int * PLONG
Definition: retypes.h:5
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN LPCWSTR Name OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
Definition: kdb_symbols.c:76
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:1091
PCHAR KdbInitFileBuffer
Definition: kdb_cli.c:124
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68