ReactOS 0.4.16-dev-258-g81860b4
|
Go to the source code of this file.
Macros | |
#define | NDEBUG |
#define | KDB_ENTER_CONDITION_TO_STRING(cond) |
#define | KDB_ACCESS_TYPE_TO_STRING(type) |
#define | NPX_STATE_TO_STRING(state) |
#define | Ke386GetGlobalDescriptorTable __sgdt |
#define | Ke386GetLocalDescriptorTable __sldt |
#define | KD_DEBUG_PRINT_FILTER(Name) { #Name, DPFLTR_##Name##_ID } |
Typedefs | |
typedef BOOLEAN(NTAPI * | PKDBG_CLI_ROUTINE) (IN PCHAR Command, IN ULONG Argc, IN PCH Argv[]) |
Functions | |
static BOOLEAN | KdbpCmdEvalExpression (ULONG Argc, PCHAR Argv[]) |
Evaluates an expression and displays the result. | |
static BOOLEAN | KdbpCmdDisassembleX (ULONG Argc, PCHAR Argv[]) |
Disassembles 10 instructions at eip or given address or displays 16 dwords from memory at given address. | |
static BOOLEAN | KdbpCmdRegs (ULONG Argc, PCHAR Argv[]) |
Displays CPU registers. | |
static BOOLEAN | KdbpCmdBackTrace (ULONG Argc, PCHAR Argv[]) |
Displays a backtrace. | |
static BOOLEAN | KdbpCmdContinue (ULONG Argc, PCHAR Argv[]) |
Continues execution of the system/leaves KDB. | |
static BOOLEAN | KdbpCmdStep (ULONG Argc, PCHAR Argv[]) |
Continues execution of the system/leaves KDB. | |
static BOOLEAN | KdbpCmdBreakPointList (ULONG Argc, PCHAR Argv[]) |
Lists breakpoints. | |
static BOOLEAN | KdbpCmdEnableDisableClearBreakPoint (ULONG Argc, PCHAR Argv[]) |
Enables, disables or clears a breakpoint. | |
static BOOLEAN | KdbpCmdBreakPoint (ULONG Argc, PCHAR Argv[]) |
Sets a software or hardware (memory) breakpoint at the given address. | |
static BOOLEAN | KdbpCmdThread (ULONG Argc, PCHAR Argv[]) |
Lists threads or switches to another thread context. | |
static BOOLEAN | KdbpCmdProc (ULONG Argc, PCHAR Argv[]) |
Lists processes or switches to another process context. | |
static BOOLEAN | KdbpCmdMod (ULONG Argc, PCHAR Argv[]) |
Lists loaded modules or the one containing the specified address. | |
static BOOLEAN | KdbpCmdGdtLdtIdt (ULONG Argc, PCHAR Argv[]) |
Displays GDT, LDT or IDT. | |
static BOOLEAN | KdbpCmdPcr (ULONG Argc, PCHAR Argv[]) |
Displays the KPCR. | |
static BOOLEAN | KdbpCmdBugCheck (ULONG Argc, PCHAR Argv[]) |
Bugchecks the system. | |
static BOOLEAN | KdbpCmdReboot (ULONG Argc, PCHAR Argv[]) |
static BOOLEAN | KdbpCmdFilter (ULONG Argc, PCHAR Argv[]) |
Displays the list of active debug channels, or enable/disable debug channels. | |
static BOOLEAN | KdbpCmdSet (ULONG Argc, PCHAR Argv[]) |
Sets or displays a config variables value. | |
static BOOLEAN | KdbpCmdHelp (ULONG Argc, PCHAR Argv[]) |
Displays help screen. | |
static BOOLEAN | KdbpCmdDmesg (ULONG Argc, PCHAR Argv[]) |
Display debug messages on screen, with paging. | |
BOOLEAN | ExpKdbgExtPool (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtPoolUsed (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtPoolFind (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtFileCache (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtDefWrites (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtIrpFind (ULONG Argc, PCHAR Argv[]) |
BOOLEAN | ExpKdbgExtHandle (ULONG Argc, PCHAR Argv[]) |
FORCEINLINE ULONG_PTR | strtoulptr (const char *nptr, char **endptr, int base) |
static BOOLEAN | KdbpEvaluateExpression (IN PCHAR Expression, IN LONG ErrOffset, OUT PULONGLONG Result) |
Evaluates an expression... | |
BOOLEAN NTAPI | KdbpGetHexNumber (IN PCHAR pszNum, OUT ULONG_PTR *pulValue) |
static BOOLEAN | KdbpGetComponentId (IN PCSTR ComponentName, OUT PULONG ComponentId) |
Retrieves the component ID corresponding to a given component name. | |
void * | memrchr (const void *s, int c, size_t n) |
static PCHAR | CountOnePageUp (_In_ PCCH Buffer, _In_ ULONG BufLength, _In_ PCCH pCurPos, _In_ const SIZE *TermSize) |
Calculate pointer position for N lines above the current position. | |
static VOID | KdpFilterEscapes (_Inout_ PSTR String) |
static VOID | KdbpPagerInternal (_In_ PCHAR Buffer, _In_ ULONG BufLength, _In_ BOOLEAN DoPage) |
Prints the given string with, page by page. | |
VOID | KdbpPager (_In_ PCHAR Buffer, _In_ ULONG BufLength) |
Prints the given string with, page by page. | |
VOID | KdbpPrint (_In_ PSTR Format, _In_ ...) |
Prints the given string with printf-like formatting. | |
VOID | KdbpPrintUnicodeString (_In_ PCUNICODE_STRING String) |
BOOLEAN NTAPI | KdbRegisterCliCallback (PVOID Callback, BOOLEAN Deregister) |
static BOOLEAN | KdbpInvokeCliCallbacks (IN PCHAR Command, IN ULONG Argc, IN PCHAR Argv[]) |
Invokes registered CLI callbacks until one of them handled the Command. | |
static BOOLEAN | KdbpDoCommand (IN PCHAR Command) |
Parses command line and executes command if found. | |
VOID | KdbpCliMainLoop (IN BOOLEAN EnteredOnSingleStep) |
KDB Main Loop. | |
VOID | KdbpCliInterpretInitFile (VOID) |
Interprets the KDBinit file from the \SystemRoot\System32\drivers\etc directory, that has been loaded by KdbpCliInit(). | |
NTSTATUS | KdbpCliInit (VOID) |
Called when KDB is initialized. | |
static VOID NTAPI | KdbDebugPrint (_In_ PCCH String, _In_ ULONG Length) |
Debug logger function. | |
NTSTATUS NTAPI | KdbInitialize (_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase) |
Initializes the KDBG debugger. | |
Variables | |
char | __ImageBase |
static PKDBG_CLI_ROUTINE | KdbCliCallbacks [10] |
static BOOLEAN | KdbUseIntelSyntax = FALSE |
static BOOLEAN | KdbBreakOnModuleLoad = FALSE |
static ULONG | KdbNumberOfRowsPrinted = 0 |
static ULONG | KdbNumberOfColsPrinted = 0 |
static BOOLEAN | KdbOutputAborted = FALSE |
static BOOLEAN | KdbRepeatLastCommand = FALSE |
volatile PCHAR | KdbInitFileBuffer = NULL |
BOOLEAN | KdbpBugCheckRequested = FALSE |
static const ULONG | KdpDmesgBufferSize = 128 * 1024 |
static PCHAR | KdpDmesgBuffer = NULL |
static volatile ULONG | KdpDmesgCurrentPosition = 0 |
static volatile ULONG | KdpDmesgFreeBytes = 0 |
static volatile ULONG | KdbDmesgTotalWritten = 0 |
static volatile BOOLEAN | KdbpIsInDmesgMode = FALSE |
static KSPIN_LOCK | KdpDmesgLogSpinLock |
const CSTRING | KdbPromptStr = RTL_CONSTANT_STRING("kdb:> ") |
struct { | |
PCSTR Name | |
ULONG Id | |
} | ComponentTable [] |
struct { | |
PCHAR Name | |
PCHAR Syntax | |
PCHAR Help | |
BOOLEAN(* Fn )(ULONG Argc, PCHAR Argv[]) | |
} | KdbDebuggerCommands [] |
#define KDB_ENTER_CONDITION_TO_STRING | ( | cond | ) |
|
static |
Calculate pointer position for N lines above the current position.
Calculate pointer position for N lines above the current displaying position within the given buffer. Used by KdbpPager().
[in] | Buffer | Character buffer to operate on. |
[in] | BufLength | Size of the buffer. |
[in] | pCurPos | Current position within the buffer. |
Definition at line 2807 of file kdb_cli.c.
Referenced by KdbpPagerInternal().
Debug logger function.
This function writes text strings into KdpDmesgBuffer, using it as a circular buffer. KdpDmesgBuffer contents can be later (re)viewed using the dmesg command. KdbDebugPrint() protects KdpDmesgBuffer from simultaneous writes by use of KdpDmesgLogSpinLock.
Definition at line 3494 of file kdb_cli.c.
Referenced by KdbInitialize().
Initializes the KDBG debugger.
[in] | DispatchTable | Pointer to the KD dispatch table. |
[in] | BootPhase | Phase of initialization. |
Definition at line 3554 of file kdb_cli.c.
Referenced by KdbInitialize().
Called when KDB is initialized.
Loads the KDBinit file from the \SystemRoot\System32\drivers\etc directory and interprets it, by calling back into the debugger.
Definition at line 3403 of file kdb_cli.c.
Referenced by KdbInitialize().
Interprets the KDBinit file from the \SystemRoot\System32\drivers\etc directory, that has been loaded by KdbpCliInit().
This function is used to interpret the init file in the debugger context with a trap frame set up. KdbpCliInit() enters the debugger by calling DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C). In turn, this will call KdbEnterDebuggerException() which will finally call this function if KdbInitFileBuffer is not NULL.
Definition at line 3351 of file kdb_cli.c.
Referenced by KdbEnterDebuggerException().
KDB Main Loop.
EnteredOnSingleStep | TRUE if KDB was entered on single step. |
Definition at line 3274 of file kdb_cli.c.
Referenced by KdbpCallMainLoop(), and KdbpCliInterpretInitFile().
Displays a backtrace.
Definition at line 1225 of file kdb_cli.c.
Sets a software or hardware (memory) breakpoint at the given address.
Definition at line 1579 of file kdb_cli.c.
Lists breakpoints.
Definition at line 1441 of file kdb_cli.c.
Disassembles 10 instructions at eip or given address or displays 16 dwords from memory at given address.
Definition at line 800 of file kdb_cli.c.
Display debug messages on screen, with paging.
Keys for per-page view: Home, End, PageUp, Arrow Up, PageDown, all others are as PageDown.
Definition at line 2515 of file kdb_cli.c.
Enables, disables or clears a breakpoint.
Definition at line 1538 of file kdb_cli.c.
Evaluates an expression and displays the result.
Definition at line 469 of file kdb_cli.c.
Displays the list of active debug channels, or enable/disable debug channels.
Definition at line 696 of file kdb_cli.c.
Displays GDT, LDT or IDT.
Definition at line 2096 of file kdb_cli.c.
Lists loaded modules or the one containing the specified address.
Definition at line 2030 of file kdb_cli.c.
Displays the KPCR.
Definition at line 2315 of file kdb_cli.c.
Lists processes or switches to another process context.
Definition at line 1912 of file kdb_cli.c.
Definition at line 2500 of file kdb_cli.c.
Displays CPU registers.
Definition at line 921 of file kdb_cli.c.
Sets or displays a config variables value.
Definition at line 2559 of file kdb_cli.c.
Lists threads or switches to another thread context.
Definition at line 1703 of file kdb_cli.c.
Parses command line and executes command if found.
TRUE | Don't continue execution. |
FALSE | Continue execution (leave KDB) |
Definition at line 3205 of file kdb_cli.c.
Referenced by KdbpCliInterpretInitFile(), and KdbpCliMainLoop().
|
static |
Evaluates an expression...
Much like KdbpRpnEvaluateExpression, but prints the error message (if any) at the given offset.
Expression | Expression to evaluate. |
ErrOffset | Offset (in characters) to print the error message at. |
Result | Receives the result on success. |
TRUE | Success. |
FALSE | Failure. |
Definition at line 423 of file kdb_cli.c.
Referenced by KdbpCmdBackTrace(), KdbpCmdBreakPoint(), KdbpCmdDisassembleX(), KdbpCmdEvalExpression(), and KdbpCmdMod().
Retrieves the component ID corresponding to a given component name.
ComponentName | The name of the component. |
ComponentId | Receives the component id on success. |
TRUE | Success. |
FALSE | Failure. |
Definition at line 675 of file kdb_cli.c.
Referenced by KdbpCmdFilter().
Definition at line 450 of file kdb_cli.c.
Invokes registered CLI callbacks until one of them handled the Command.
Command | - Command line to parse and execute if possible. |
Argc | - Number of arguments in Argv |
Argv | - Array of strings, each of them containing one argument. |
Definition at line 3171 of file kdb_cli.c.
Referenced by KdbpDoCommand().
Prints the given string with, page by page.
Note: BufLength should be greater than (KdTermSize.cx * KdTermSize.cy).
Definition at line 3063 of file kdb_cli.c.
Referenced by KdbpCmdDmesg().
|
static |
Prints the given string with, page by page.
Note: BufLength should be greater than (KdTermSize.cx * KdTermSize.cy).
Definition at line 2887 of file kdb_cli.c.
Referenced by KdbpPager(), and KdbpPrint().
Prints the given string with printf-like formatting.
Format | Format of the string/arguments. |
... | Variable number of arguments matching the format specified in Format. |
Definition at line 3081 of file kdb_cli.c.
Referenced by KdbpAttachToProcess(), KdbpAttachToThread(), KdbpCmdBackTrace(), KdbpCmdBreakPoint(), KdbpCmdBreakPointList(), KdbpCmdDisassembleX(), KdbpCmdDmesg(), KdbpCmdEnableDisableClearBreakPoint(), KdbpCmdEvalExpression(), KdbpCmdFilter(), KdbpCmdGdtLdtIdt(), KdbpCmdHelp(), KdbpCmdMod(), KdbpCmdPcr(), KdbpCmdProc(), KdbpCmdRegs(), KdbpCmdSet(), KdbpCmdStep(), KdbpCmdThread(), KdbpEvaluateExpression(), and KdbpPrintUnicodeString().
VOID KdbpPrintUnicodeString | ( | _In_ PCUNICODE_STRING | String | ) |
Definition at line 3104 of file kdb_cli.c.
Referenced by KdbpCmdMod().
Definition at line 3124 of file kdb_cli.c.
Referenced by KdSystemDebugControl().
Definition at line 2851 of file kdb_cli.c.
Referenced by KdbpPagerInternal().
Definition at line 2771 of file kdb_cli.c.
Referenced by CountOnePageUp().
|
extern |
Referenced by KdbpCmdMod().
struct { ... } ComponentTable[] |
Referenced by KdbpCmdFilter(), and KdbpGetComponentId().
Definition at line 346 of file kdb_cli.c.
Referenced by UhciGet32BitFrameNumber().
int Help |
Definition at line 345 of file kdb_cli.c.
Referenced by create_system_dirid(), and KdbpCmdHelp().
ULONG Id |
Definition at line 160 of file kdb_cli.c.
Referenced by KdbpCmdFilter().
Definition at line 130 of file kdb_cli.c.
Referenced by KdbpCmdSet().
|
static |
Definition at line 128 of file kdb_cli.c.
Referenced by KdbpInvokeCliCallbacks(), and KdbRegisterCliCallback().
const struct { ... } KdbDebuggerCommands[] |
Referenced by KdbpCmdHelp(), and KdbpDoCommand().
Definition at line 145 of file kdb_cli.c.
Referenced by KdbDebugPrint(), KdbInitialize(), and KdbpCmdDmesg().
Definition at line 137 of file kdb_cli.c.
Referenced by KdbEnterDebuggerException(), KdbpCliInit(), and KdbpCliInterpretInitFile().
|
static |
Definition at line 133 of file kdb_cli.c.
Referenced by KdbpDoCommand(), and KdbpPagerInternal().
|
static |
Definition at line 132 of file kdb_cli.c.
Referenced by KdbpDoCommand(), and KdbpPagerInternal().
Definition at line 134 of file kdb_cli.c.
Referenced by KdbpCmdBackTrace(), KdbpDoCommand(), KdbpPagerInternal(), and KdbpPrint().
Definition at line 138 of file kdb_cli.c.
Referenced by KdbEnterDebuggerException(), and KdbpCmdBugCheck().
Definition at line 146 of file kdb_cli.c.
Referenced by KdbDebugPrint(), and KdbpCmdDmesg().
const CSTRING KdbPromptStr = RTL_CONSTANT_STRING("kdb:> ") |
Definition at line 149 of file kdb_cli.c.
Referenced by KdbpCmdBackTrace(), KdbpCmdBreakPoint(), KdbpCmdDisassembleX(), KdbpCmdEvalExpression(), KdbpCmdMod(), and KdReceivePacket().
Definition at line 135 of file kdb_cli.c.
Referenced by KdbpCliMainLoop(), and KdbpPagerInternal().
Definition at line 129 of file kdb_cli.c.
Referenced by KdbpCliMainLoop(), KdbpCmdDisassembleX(), and KdbpCmdSet().
Definition at line 142 of file kdb_cli.c.
Referenced by KdbDebugPrint(), KdbInitialize(), and KdbpCmdDmesg().
Definition at line 141 of file kdb_cli.c.
Referenced by KdbDebugPrint(), KdbInitialize(), and KdbpCmdDmesg().
Definition at line 143 of file kdb_cli.c.
Referenced by KdbDebugPrint(), and KdbpCmdDmesg().
Definition at line 144 of file kdb_cli.c.
Referenced by KdbDebugPrint(), KdbInitialize(), and KdbpCmdDmesg().
|
static |
Definition at line 147 of file kdb_cli.c.
Referenced by KdbDebugPrint(), and KdbInitialize().
Definition at line 159 of file kdb_cli.c.
Referenced by KdbpCmdFilter().
PCHAR Syntax |
Definition at line 344 of file kdb_cli.c.
Referenced by KdbpCmdHelp().