ReactOS  0.4.15-dev-2964-ge2a8585
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 */
14 
16 {
22 
23 typedef enum _KDB_ACCESS_TYPE
24 {
30 
31 typedef struct _KDB_BREAKPOINT
32 {
33  KDB_BREAKPOINT_TYPE Type; /* Type of breakpoint */
34  BOOLEAN Enabled; /* Whether the bp is enabled */
35  ULONG_PTR Address; /* Address of the breakpoint */
36  BOOLEAN Global; /* Whether the breakpoint is global or local to a process */
37  PEPROCESS Process; /* Owning process */
40  union {
41  /* KdbBreakPointSoftware */
43  /* KdbBreakPointHardware */
44  struct {
46  UCHAR Size : 3;
48  } Hw;
49  } Data;
51 
53 {
59 
60 /* These values MUST be nonzero. They're used as bit masks. */
62 {
66 
67 /* FUNCTIONS *****************************************************************/
68 
69 /* from i386/i386-dis.c */
70 
71 LONG
74  IN ULONG IntelSyntax);
75 
76 LONG
78  IN ULONG Address);
79 
80 /* from i386/kdb_help.S */
81 
82 VOID NTAPI
84  IN PVOID NewStack,
85  IN VOID (*Function)(VOID));
86 
87 /* from kdb_cli.c */
88 
90 
91 BOOLEAN
92 NTAPI
95  BOOLEAN Deregister);
96 
97 VOID
99 
100 VOID
102  IN BOOLEAN EnteredOnSingleStep);
103 
104 VOID
107 
108 VOID
110 
111 VOID
112 KdbpPrint(
113  IN PCHAR Format,
114  IN ... OPTIONAL);
115 
116 BOOLEAN
117 NTAPI
119  IN PCHAR pszNum,
120  OUT ULONG_PTR *pulValue);
121 
122 /* from kdb_expr.c */
123 
124 BOOLEAN
127  IN PKDB_KTRAP_FRAME TrapFrame,
129  OUT PLONG ErrOffset OPTIONAL,
130  OUT PCHAR ErrMsg OPTIONAL);
131 
132 PVOID
135  OUT PLONG ErrOffset OPTIONAL,
136  OUT PCHAR ErrMsg OPTIONAL);
137 
138 BOOLEAN
141  IN PKDB_KTRAP_FRAME TrapFrame,
143  OUT PLONG ErrOffset OPTIONAL,
144  OUT PCHAR ErrMsg OPTIONAL);
145 
146 /* from kdb_symbols.c */
147 
148 BOOLEAN
152  OUT PLDR_DATA_TABLE_ENTRY* pLdrEntry);
153 
154 BOOLEAN
156  IN PVOID Address,
158 );
159 
160 VOID
163  _In_ BOOLEAN Load);
164 
165 /* from kdb.c */
166 
170 extern ULONG KdbNumSingleSteps;
173 extern ULONG KdbDebugState;
174 
175 LONG
178 
179 BOOLEAN
181  IN ULONG BreakPointNr,
185  OUT KDB_ACCESS_TYPE *AccessType OPTIONAL,
186  OUT UCHAR *DebugReg OPTIONAL,
190  OUT PCHAR *ConditionExpression OPTIONAL);
191 
192 NTSTATUS
197  IN KDB_ACCESS_TYPE AccessType OPTIONAL,
198  IN PCHAR ConditionExpression OPTIONAL,
199  IN BOOLEAN Global,
200  OUT PLONG BreakPointNr OPTIONAL);
201 
202 BOOLEAN
204  IN LONG BreakPointNr OPTIONAL,
205  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
206 
207 BOOLEAN
209  IN LONG BreakPointNr OPTIONAL,
210  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
211 
212 BOOLEAN
214  IN LONG BreakPointNr OPTIONAL,
215  IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL);
216 
217 BOOLEAN
219  IN LONG ExceptionNr,
220  IN BOOLEAN FirstChance,
222 
223 BOOLEAN
225  IN LONG ExceptionNr,
226  IN BOOLEAN FirstChance,
228 
229 BOOLEAN
231  PVOID ThreadId);
232 
233 BOOLEAN
235  PVOID ProcessId);
236 
237 VOID
238 NTAPI
240 
241 KD_CONTINUE_TYPE
245  IN BOOLEAN FirstChance);
246 
247 KD_CONTINUE_TYPE
249  IN OUT PKTRAP_FRAME TrapFrame);
250 
251 /* other functions */
252 
253 NTSTATUS
255  IN PVOID Src,
256  IN ULONG Bytes);
257 
258 NTSTATUS
260  IN PVOID Src,
261  IN ULONG Bytes);
262 
263 #define KdbpGetCharKeyboard(ScanCode) KdbpTryGetCharKeyboard(ScanCode, 0)
264 CHAR
266 
267 #define KdbpGetCharSerial() KdbpTryGetCharSerial(0)
268 CHAR
270 
271 VOID
272 KdbEnter(VOID);
273 VOID
275 VOID
277 VOID
279 VOID
281 VOID
283 VOID
BOOLEAN KdbSingleStepOver
Definition: kdb.c:44
signed char * PCHAR
Definition: retypes.h:7
KDB_ACCESS_TYPE AccessType
Definition: kdb.h:47
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:2709
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
Definition: kdb.c:1032
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:1143
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:473
LONG KdbpGetInstLength(IN ULONG Address)
Definition: i386-dis.c:95
ULONG ScanCode
Definition: api.c:39
UCHAR DebugReg
Definition: kdb.h:45
_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
VOID KdbEnter(VOID)
BOOLEAN Global
Definition: kdb.h:36
CONTEXT KDB_KTRAP_FRAME
Definition: kdb.h:13
char CHAR
Definition: xmlstorage.h:175
PCHAR ConditionExpression
Definition: kdb.h:38
LONG NTSTATUS
Definition: precomp.h:26
_In_ UINT Bytes
Definition: mmcopy.h:9
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UCHAR Size
Definition: kdb.h:46
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
Definition: kdb_cli.c:3784
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
Definition: kdb.c:864
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:465
IN PVCB IN PBCB OUT PDIRENT IN USHORT IN POEM_STRING Filename
Definition: fatprocs.h:934
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:697
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:404
_KDB_OUTPUT_SETTINGS
Definition: kdb.h:61
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:1653
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:991
long LONG
Definition: pedump.c:60
CHAR * PCH
Definition: ntbasedef.h:391
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:594
_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:1620
VOID KbdEnableMouse(VOID)
ULONG_PTR Address
Definition: kdb.h:35
IN PSCSI_REQUEST_BLOCK IN OUT NTSTATUS IN OUT BOOLEAN * Retry
Definition: class2.h:49
PVOID Condition
Definition: kdb.h:39
struct _KDB_BREAKPOINT::@1793::@1794 Hw
IN ULONG IN UCHAR Condition
struct _KDB_BREAKPOINT * PKDB_BREAKPOINT
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
Definition: kdb_cli.c:3706
union _KDB_BREAKPOINT::@1793 Data
CONTEXT * PKDB_KTRAP_FRAME
Definition: kdb.h:13
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
Definition: kdb.c:1113
_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:2716
VOID KbdDisableMouse(VOID)
Type
Definition: Type.h:6
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
VOID DbgDisableFile(PCH Filename)
Definition: partlist.h:33
_KDB_ENTER_CONDITION
Definition: kdb.h:52
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:121
VOID DbgEnableFile(PCH Filename)
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
_KDB_BREAKPOINT_TYPE
Definition: kdb.h:15
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
Definition: kdb.c:51
Definition: btrfs_drv.h:1922
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:1197
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
Definition: wdfinterrupt.h:456
PEPROCESS Process
Definition: kdb.h:37
UCHAR SavedInstruction
Definition: kdb.h:42
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
Definition: kdb.c:377
VOID DbgRDebugInit(VOID)
VOID KdbpCliInit(VOID)
Called when KDB is initialized.
Definition: kdb_cli.c:3833
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:969
VOID KdbpCliModuleLoaded(IN PUNICODE_STRING Name)
Called when a module is loaded.
Definition: kdb_cli.c:3767
_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:1683
VOID DbgShowFiles(VOID)
unsigned int ULONG
Definition: retypes.h:1
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
Definition: kdb_cli.c:3563
BOOLEAN Enabled
Definition: kdb.h:34
_KDB_ACCESS_TYPE
Definition: kdb.h:23
KDB_BREAKPOINT_TYPE Type
Definition: kdb.h:33
NTSTATUS KdbpSafeWriteMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
Definition: kdb.c:1697
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:1103
PCHAR KdbInitFileBuffer
Definition: kdb_cli.c:153
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68