34#include "../kd/kdterminal.h"
41#define KDB_ENTER_CONDITION_TO_STRING(cond) \
42 ((cond) == KdbDoNotEnter ? "never" : \
43 ((cond) == KdbEnterAlways ? "always" : \
44 ((cond) == KdbEnterFromKmode ? "kmode" : "umode")))
46#define KDB_ACCESS_TYPE_TO_STRING(type) \
47 ((type) == KdbAccessRead ? "read" : \
48 ((type) == KdbAccessWrite ? "write" : \
49 ((type) == KdbAccessReadWrite ? "rdwr" : "exec")))
51#define NPX_STATE_TO_STRING(state) \
52 ((state) == NPX_STATE_LOADED ? "Loaded" : \
53 ((state) == NPX_STATE_NOT_LOADED ? "Not loaded" : "Unknown"))
100#ifndef Ke386GetGlobalDescriptorTable
101# define Ke386GetGlobalDescriptorTable __sgdt
103#ifndef Ke386GetLocalDescriptorTable
104# define Ke386GetLocalDescriptorTable __sldt
154#define KD_DEBUG_PRINT_FILTER(Name) \
155 { #Name, DPFLTR_##Name##_ID }
336#undef KD_DEBUG_PRINT_FILTER
352 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
354 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
355 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
356 {
"cregs",
"cregs",
"Display control, descriptor table and task segment registers.",
KdbpCmdRegs },
357 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
358 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
359 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
361 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
365 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
366 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
367 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
372 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
373 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
377 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
378 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
382 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
385 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
386 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
388 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.", KdbpCmdTss },
395 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
396 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
397 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
398 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
399 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
400 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
401 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
402 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
405 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
406 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
429 static CHAR ErrMsgBuffer[130] =
"^ ";
430 LONG ExpressionErrOffset = -1;
435 &ExpressionErrOffset, ErrMsgBuffer + 2);
438 if (ExpressionErrOffset >= 0)
439 ExpressionErrOffset += ErrOffset;
458 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
462 *pulValue =
strtoul(pszNum, &endptr, 16);
464 return (*endptr ==
'\0');
489 for (
i = 1;
i < Argc;
i++)
499 if (
Result > 0x00000000ffffffffLL)
501 if (
Result & 0x8000000000000000LL)
510 if (ul <= 0xff && ul >= 0x80)
512 else if (ul <= 0xffff && ul >= 0x8000)
518 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
532KdbpPrintStructInternal
549 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
554 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
560 switch (Member->
Size) {
577 if (Member->
Size < 8) {
580 for (
j = 0;
j < Member->
Size;
j++) {
584 }
else goto readfail;
587 Indent[IndentLen] =
' ';
592 Indent[IndentLen] = 0;
599 if (Member->
Size <= 8) {
603 Indent[IndentLen] =
' ';
605 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
608 Indent[IndentLen] = 0;
628 CHAR Indent[100] = {0};
631 if (Argc < 3)
goto end;
633 AnsiName.
Buffer = Argv[1];
635 Info = KdbpSymFindCachedFile(&ModName);
638 DPRINT1(
"Could not get aggregate\n");
645 PCHAR ArgStart = Argv[3];
646 DPRINT(
"Trying to get expression\n");
647 for (
i = 3;
i < Argc - 1;
i++)
654 DPRINT(
"Arg: %s\n", ArgStart);
723 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n"
724 " messages without Component ID and Level.\n"
725 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n"
726 " an unknown Component ID.\n\n");
727 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
728 KdbpPrint(
" Component Name Component ID\n"
729 " ================== ================\n");
737 for (
i = 1;
i < Argc;
i++)
748 if (
len != (
p - opt))
764 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
780 if (*
p ==
'+' || *
p ==
'-')
785 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
812 if (Argv[0][0] ==
'x')
821 if (
strcmp(Argv[Argc-2],
"L") == 0)
830 else if (Argv[Argc-1][0] ==
'L')
842 for (ul = 1; ul < Argc; ul++)
844 Argv[ul][
strlen(Argv[ul])] =
' ';
860 else if (Argv[0][0] ==
'x')
862 KdbpPrint(
"x: Address argument required.\n");
866 if (Argv[0][0] ==
'x')
928 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
929 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
930 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
931 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
932 " BIT23",
" BIT24",
" BIT25",
" BIT26",
933 " BIT27",
" BIT28",
" BIT29",
" BIT30",
936 if (Argv[0][0] ==
'r')
940 "SS:ESP 0x%04x:0x%08x\n"
941 " EAX 0x%08x EBX 0x%08x\n"
942 " ECX 0x%08x EDX 0x%08x\n"
943 " ESI 0x%08x EDI 0x%08x\n"
953 "SS:RSP 0x%04x:0x%p\n"
954 " RAX 0x%p RBX 0x%p\n"
955 " RCX 0x%p RDX 0x%p\n"
956 " RSI 0x%p RDI 0x%p\n"
967 for (
i = 0;
i < 32;
i++)
971 if ((
Context->EFlags & (1 << 1)) == 0)
981 else if ((
Context->EFlags & (1 <<
i)) != 0)
988 else if (Argv[0][0] ==
'c')
990 ULONG Cr0, Cr2, Cr3, Cr4;
993 static const PCHAR Cr0Bits[32] = {
" PE",
" MP",
" EM",
" TS",
" ET",
" NE",
NULL,
NULL,
997 static const PCHAR Cr4Bits[32] = {
" VME",
" PVI",
" TSD",
" DE",
" PSE",
" PAE",
" MCE",
" PGE",
1007 Input.Buffer = &SpecialRegisters;
1008 Input.Request =
sizeof(SpecialRegisters);
1023 Cr0 = SpecialRegisters.
Cr0;
1024 Cr2 = SpecialRegisters.
Cr2;
1025 Cr3 = SpecialRegisters.
Cr3;
1026 Cr4 = SpecialRegisters.
Cr4;
1029 Gdtr = SpecialRegisters.
Gdtr;
1030 Ldtr = SpecialRegisters.
Ldtr;
1031 Idtr = SpecialRegisters.
Idtr;
1032 Tr = SpecialRegisters.
Tr;
1036 for (
i = 0;
i < 32;
i++)
1041 if ((Cr0 & (1 <<
i)) != 0)
1047 KdbpPrint(
"CR3 0x%08x Pagedir-Base 0x%08x %s%s\n", Cr3, (Cr3 & 0xfffff000),
1048 (Cr3 & (1 << 3)) ?
" PWT" :
"", (Cr3 & (1 << 4)) ?
" PCD" :
"" );
1050 for (
i = 0;
i < 32;
i++)
1055 if ((Cr4 & (1 <<
i)) != 0)
1063 KdbpPrint(
"IDTR Base 0x%08x Size 0x%04x\n", Idtr.Base, Idtr.Limit);
1066 else if (Argv[0][0] ==
's')
1068 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
1071 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
1073 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
1075 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
1077 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
1079 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
1084 ASSERT(Argv[0][0] ==
'd');
1116 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1161 (
PVOID)&Tss->Backlink,
1168 return (Backlink != 0 && Backlink != TssSelector);
1172KdbpContextFromPrevTss(
1195 Tss = KdbpRetrieveTss(Backlink,
NULL, pGdtr);
1214 *TssSelector = Backlink;
1230 PRUNTIME_FUNCTION FunctionEntry;
1238 if (FunctionEntry ==
NULL)
1290 GotNextFrame = GetNextFrame(&
Context);
1318 if (
strcmp(Argv[Argc-2],
"L") == 0)
1326 else if (Argv[Argc-1][0] ==
'L')
1337 for (ul = 1; ul < Argc; ul++)
1339 Argv[ul][
strlen(Argv[ul])] =
' ';
1347 if (Argv[1][0] ==
'*')
1362 KdbpPrint(
"Thread backtrace not supported yet!\n");
1376 TssSelector = Ke386GetTr();
1377 Tss = KdbpRetrieveTss(TssSelector,
NULL, &Gdtr);
1378 if (KdbpIsNestedTss(TssSelector, Tss))
1381 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1402 goto CheckForParentTSS;
1408 goto CheckForParentTSS;
1412 goto CheckForParentTSS;
1433 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1434 goto CheckForParentTSS;
1448 if (!KdbpIsNestedTss(TssSelector, Tss))
1451 GotNextFrame = KdbpContextFromPrevTss(&
Context, &TssSelector, &Tss, &Gdtr);
1462 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1501 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1506 if (Argv[0][0] ==
'n')
1533 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1565 GlobalOrLocal =
" global";
1576 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1580 ConditionExpr ?
" IF " :
"",
1581 ConditionExpr ? ConditionExpr :
"",
1590 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1592 ConditionExpr ?
" IF " :
"",
1593 ConditionExpr ? ConditionExpr :
"",
1600 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1603 ConditionExpr ?
" IF " :
"",
1604 ConditionExpr ? ConditionExpr :
"",
1626 KdbpPrint(
"%s: argument required\n", Argv[0]);
1631 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1632 if (pend == Argv[1] || *pend !=
'\0')
1634 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1638 if (Argv[0][1] ==
'e')
1642 else if (Argv [0][1] ==
'd')
1648 ASSERT(Argv[0][1] ==
'c');
1665 ULONG AddressArgIndex,
i;
1666 LONG ConditionArgIndex;
1669 if (Argv[0][2] ==
'x')
1673 KdbpPrint(
"bpx: Address argument required.\n");
1677 AddressArgIndex = 1;
1682 ASSERT(Argv[0][2] ==
'm');
1686 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1692 else if (
_stricmp(Argv[1],
"r") == 0)
1694 else if (
_stricmp(Argv[1],
"w") == 0)
1696 else if (
_stricmp(Argv[1],
"rw") == 0)
1700 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1710 AddressArgIndex = 3;
1711 if (
_stricmp(Argv[2],
"byte") == 0)
1713 else if (
_stricmp(Argv[2],
"word") == 0)
1715 else if (
_stricmp(Argv[2],
"dword") == 0)
1724 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1728 if (Argc <= AddressArgIndex)
1730 KdbpPrint(
"bpm: Address argument required.\n");
1738 ConditionArgIndex = -1;
1739 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1741 if (
strcmp(Argv[
i+1],
"IF") == 0)
1743 ConditionArgIndex =
i + 2;
1744 if ((
ULONG)ConditionArgIndex >= Argc)
1746 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1750 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1768 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1773 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1797 "Initialized",
"Ready",
"Running",
1798 "Standby",
"Terminated",
"Waiting",
1799 "Transition",
"DeferredReady"
1804 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1811 if (Argv[2] == pend)
1813 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1819 KdbpPrint(
"thread: Invalid process id!\n");
1824 ReferencedProcess =
TRUE;
1833 KdbpPrint(
"No threads in current process!\n");
1835 if (ReferencedProcess)
1841 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1884 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1899 if (ReferencedProcess)
1902 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1906 KdbpPrint(
"thread attach: thread id argument required!\n");
1911 if (Argv[2] == pend)
1913 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1922 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1931 if (Argv[1] == pend)
1933 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1939 KdbpPrint(
"thread: Invalid thread id!\n");
1944 ReferencedThread =
TRUE;
1954 " State: %s (0x%x)\n"
1956 " Affinity: 0x%08x\n"
1957 " Initial Stack: 0x%08x\n"
1958 " Stack Limit: 0x%08x\n"
1959 " Stack Base: 0x%08x\n"
1960 " Kernel Stack: 0x%08x\n"
1961 " Trap Frame: 0x%08x\n"
1963 " NPX State: %s (0x%x)\n"
1965 , (Argc < 2) ?
"Current Thread:\n" :
""
1981 if (ReferencedThread)
2002 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
2007 KdbpPrint(
"No processes in the system!\n");
2041 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
2045 KdbpPrint(
"process attach: process id argument required!\n");
2050 if (Argv[2] == pend)
2052 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
2071 if (Argv[1] == pend)
2073 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
2079 KdbpPrint(
"proc: Invalid process id!\n");
2084 ReferencedProcess =
TRUE;
2091 " State: %s (0x%x)\n"
2092 " Image Filename: %s\n",
2093 (Argc < 2) ?
"Current process:\n" :
"",
2099 if (ReferencedProcess)
2124 Argv[Argc][
strlen(Argv[Argc])] =
' ';
2133 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
2143 DisplayOnlyOneModule =
TRUE;
2151 KdbpPrint(
" %p %08x %s\n", (
PVOID)ntoskrnlBase, 0,
"ntoskrnl.exe");
2189 if (Argv[0][0] ==
'i')
2196 KdbpPrint(
"Interrupt descriptor table is empty.\n");
2201 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
2203 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2211 Dpl = ((SegDesc[1] >> 13) & 3);
2212 if ((SegDesc[1] & 0x1f00) == 0x0500)
2213 SegType =
"TASKGATE";
2214 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2215 SegType =
"INTGATE32";
2216 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2217 SegType =
"INTGATE16";
2218 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2219 SegType =
"TRAPGATE32";
2220 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2221 SegType =
"TRAPGATE16";
2223 SegType =
"UNKNOWN";
2225 if ((SegDesc[1] & (1 << 15)) == 0)
2227 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2228 i / 8, SegType, Dpl);
2230 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2232 SegSel = SegDesc[0] >> 16;
2234 i / 8, SegType, SegSel, Dpl);
2238 SegSel = SegDesc[0] >> 16;
2239 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2240 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2241 i / 8, SegType, SegSel, SegBase, Dpl);
2249 if (Argv[0][0] ==
'g')
2257 ASSERT(Argv[0][0] ==
'l');
2268 KdbpPrint(
"%s descriptor table is empty.\n",
2269 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2273 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2274 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2275 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2277 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2285 Dpl = ((SegDesc[1] >> 13) & 3);
2286 Type = ((SegDesc[1] >> 8) & 0xf);
2288 SegBase = SegDesc[0] >> 16;
2289 SegBase |= (SegDesc[1] & 0xff) << 16;
2290 SegBase |= SegDesc[1] & 0xff000000;
2291 SegLimit = SegDesc[0] & 0x0000ffff;
2292 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2294 if ((SegDesc[1] & (1 << 23)) != 0)
2304 if ((SegDesc[1] & (1 << 12)) == 0)
2308 case 1: SegType =
"TSS16(Avl)";
break;
2309 case 2: SegType =
"LDT";
break;
2310 case 3: SegType =
"TSS16(Busy)";
break;
2311 case 4: SegType =
"CALLGATE16";
break;
2312 case 5: SegType =
"TASKGATE";
break;
2313 case 6: SegType =
"INTGATE16";
break;
2314 case 7: SegType =
"TRAPGATE16";
break;
2315 case 9: SegType =
"TSS32(Avl)";
break;
2316 case 11: SegType =
"TSS32(Busy)";
break;
2317 case 12: SegType =
"CALLGATE32";
break;
2318 case 14: SegType =
"INTGATE32";
break;
2319 case 15: SegType =
"TRAPGATE32";
break;
2320 default: SegType =
"UNKNOWN";
break;
2330 else if ((SegDesc[1] & (1 << 11)) == 0)
2332 if ((SegDesc[1] & (1 << 22)) != 0)
2339 if ((SegDesc[1] & (1 << 22)) != 0)
2345 if ((SegDesc[1] & (1 << 15)) == 0)
2347 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2348 i / 8,
i | Dpl | ul, SegType, Dpl);
2352 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2353 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2355 if ((SegDesc[1] & (1 << 12)) == 0)
2359 else if ((SegDesc[1] & (1 << 11)) == 0)
2361 if ((SegDesc[1] & (1 << 10)) != 0)
2364 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2366 if ((SegDesc[1] & (1 << 8)) != 0)
2371 if ((SegDesc[1] & (1 << 10)) != 0)
2374 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2376 if ((SegDesc[1] & (1 << 8)) != 0)
2380 if ((SegDesc[1] & (1 << 20)) != 0)
2400 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2402 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n"
2403 " Tib.StackBase: 0x%08x\n"
2404 " Tib.StackLimit: 0x%08x\n"
2405 " Tib.SubSystemTib: 0x%08x\n"
2406 " Tib.FiberData/Version: 0x%08x\n"
2407 " Tib.ArbitraryUserPointer: 0x%08x\n"
2408 " Tib.Self: 0x%08x\n"
2409 " SelfPcr: 0x%08x\n"
2413 " IrrActive: 0x%08x\n"
2415 " KdVersionBlock: 0x%08x\n"
2419 " MajorVersion: 0x%04x\n"
2420 " MinorVersion: 0x%04x\n"
2421 " SetMember: 0x%08x\n"
2422 " StallScaleFactor: 0x%08x\n"
2424 " L2CacheAssociativity: 0x%02x\n"
2425 " VdmAlert: 0x%08x\n"
2426 " L2CacheSize: 0x%08x\n"
2427 " InterruptMode: 0x%08x\n"
2483 PCHAR Param, pszNext;
2487 if (Argv[1][0] ==
'*')
2490 ulValue =
strtoul(Param, &pszNext, 0);
2491 if (pszNext && *pszNext)
2493 KdbpPrint(
"Invalid TSS specification.\n");
2497 if (Argv[1][0] ==
'*')
2506 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2513 TssSelector = (
USHORT)ulValue;
2514 Tss = KdbpRetrieveTss(TssSelector,
NULL,
NULL);
2517 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2526 TssSelector = Ke386GetTr();
2531 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2532 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2534 " Ss0:Esp0: 0x%04x:0x%08x\n"
2555 " IoMapBase: 0x%04x\n",
2603 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2607 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2625 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2628 KdbpPrint(
"*** Dmesg: end of output ***\n");
2648 static const PCHAR ExceptionNames[21] =
2650 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2651 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2652 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2653 "MACHINECHECK",
"SIMDFAULT",
"OTHERS"
2660 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2661 KdbpPrint(
" break_on_module_load [true|false]\n");
2663 else if (
strcmp(Argv[1],
"syntax") == 0)
2671 if (
_stricmp(Argv[2],
"intel") == 0)
2673 else if (
_stricmp(Argv[2],
"at&t") == 0)
2676 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2679 else if (
strcmp(Argv[1],
"condition") == 0)
2683 KdbpPrint(
"Conditions: (First) (Last)\n");
2686 if (!ExceptionNames[
l])
2695 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2701 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2707 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2715 if (Argv[2] == pend)
2719 if (!ExceptionNames[
l])
2722 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2729 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2736 if (
_stricmp(Argv[3],
"first") == 0)
2738 else if (
_stricmp(Argv[3],
"last") == 0)
2742 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2746 if (
_stricmp(Argv[4],
"never") == 0)
2748 else if (
_stricmp(Argv[4],
"always") == 0)
2750 else if (
_stricmp(Argv[4],
"umode") == 0)
2752 else if (
_stricmp(Argv[4],
"kmode") == 0)
2756 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2763 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2765 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2778 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2779 l, ExceptionNames[
l],
2785 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2792 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2800 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2803 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2808 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2823 KdbpPrint(
"Kernel debugger commands:\n");
2852 const unsigned char *
cp;
2856 cp = (
unsigned char *)
s +
n;
2859 if (*(--
cp) == (
unsigned char)
c)
2894 ULONG p0len = TermSize->cx * TermSize->cy;
2895 PCCH p0 = pCurPos - p0len;
2896 PCCH prev_p = p0, p1;
2906 for (
j = TermSize->cy;
j--; )
2919 linesCnt = (TermSize->cx+prev_p-
p-2) / TermSize->cx;
2976 LONG RowsPrintedByTerminal;
2986 if (!TerminalInitialized)
2988 TerminalInitialized =
TRUE;
3000 while (
p[0] !=
'\0')
3006 KdbPrintf(
"Dmesg: error, p > Buffer+BufLength,d=%d",
p - (
Buffer + BufLength));
3024 RowsPrintedByTerminal = 0;
3027 RowsPrintedByTerminal++;
3044 Prompt =
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---";
3046 Prompt =
"--- Press q to abort, any other key to continue ---";
3055 RowsPrintedByTerminal++;
3089 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3292 static PCHAR Argv[256];
3293 static CHAR OrigCommand[1024];
3302 while (*
p ==
'\t' || *
p ==
' ')
3341 KdbPrintf(
"Command '%s' is unknown.\n", OrigCommand);
3358 static CHAR LastCommand[1024] =
"";
3366 if (EnteredOnSingleStep)
3380 KdbPuts(
"\nType \"help\" for a list of commands.\n");
3398 else if (CmdLen > 1)
3439 KdbPuts(
"KDB: Executing KDBinit file...\n");
3440 while (p1[0] !=
'\0')
3453 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3454 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3459 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3469 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3472 KdbPuts(
"KDB: KDBinit executed\n");
3518 &FileStdInfo,
sizeof(FileStdInfo),
3545 DPRINT1(
"Could not read KDBinit file into memory (Status 0x%lx)\n",
Status);
3656 else if (BootPhase == 1)
3688 " KDBG debugger enabled - %s\r\n",
3691 :
"Loading symbols");
int strcmp(const char *String1, const char *String2)
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
#define COVERAGE(name, NAME, description, tag1, tag2, tag3, tag4)
#define DPFLTR_ERROR_LEVEL
#define FILE_NON_DIRECTORY_FILE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
#define _strnicmp(_String1, _String2, _MaxCount)
#define InterlockedExchangePointer(Target, Value)
#define InsertTailList(ListHead, Entry)
#define KeInitializeSpinLock(sl)
#define ExAllocatePool(type, size)
struct _FileName FileName
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
#define FILE_SYNCHRONOUS_IO_NONALERT
#define FILE_NO_INTERMEDIATE_BUFFERING
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define UNW_FLAG_NHANDLER
VOID NTAPI HalReturnToFirmware(_In_ FIRMWARE_REENTRY Action)
LONG KdbpDisassemble(IN ULONG_PTR Address, IN ULONG IntelSyntax)
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
__INTRIN_INLINE void __sidt(void *Destination)
VOID NTAPI KdbpReleaseLock(_In_ PKSPIN_LOCK SpinLock, _In_ KIRQL OldIrql)
KIRQL NTAPI KdbpAcquireLock(_In_ PKSPIN_LOCK SpinLock)
NTSTATUS NTAPI NtSetDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level, _In_ BOOLEAN State)
NTSTATUS NTAPI KdSystemDebugControl(_In_ SYSDBG_COMMAND Command, _In_reads_bytes_(InputBufferLength) PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_writes_bytes_(OutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _Out_opt_ PULONG ReturnLength, _In_ KPROCESSOR_MODE PreviousMode)
Perform various queries to the kernel debugger.
PEPROCESS KdbCurrentProcess
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
PETHREAD KdbCurrentThread
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
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.
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
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.
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
BOOLEAN KdbpEnableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Enables a breakpoint.
BOOLEAN KdbSingleStepOver
BOOLEAN KdbpDeleteBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Deletes a breakpoint.
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.
NTSTATUS KdbpSafeReadMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
VOID KdbpGetCommandLineSettings(_In_ PCSTR p1)
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.
BOOLEAN KdbSymPrintAddress(IN PVOID Address, IN PCONTEXT Context)
Print address...
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
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.
VOID KdbpCommandHistoryAppend(_In_ PCSTR Command)
Appends a command to the command history.
VOID KdbPuts(_In_ PCSTR String)
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
BOOLEAN KdbSymInit(_In_ ULONG BootPhase)
Initializes the KDB symbols implementation.
VOID __cdecl KdbPrintf(_In_ PCSTR Format,...)
SIZE_T KdbPrompt(_In_ PCSTR Prompt, _Out_ PCHAR Buffer, _In_ SIZE_T Size)
enum _KDB_ACCESS_TYPE KDB_ACCESS_TYPE
enum _KDB_BREAKPOINT_TYPE KDB_BREAKPOINT_TYPE
VOID KdbpPager(_In_ PCHAR Buffer, _In_ ULONG BufLength)
Prints the given string with, page by page.
static BOOLEAN KdbRepeatLastCommand
static struct @1855 ComponentTable[]
static BOOLEAN KdbpCmdBreakPointList(ULONG Argc, PCHAR Argv[])
Lists breakpoints.
#define KDB_ACCESS_TYPE_TO_STRING(type)
static ULONG KdbNumberOfRowsPrinted
static BOOLEAN KdbpCmdEnableDisableClearBreakPoint(ULONG Argc, PCHAR Argv[])
Enables, disables or clears a breakpoint.
#define KDB_ENTER_CONDITION_TO_STRING(cond)
static BOOLEAN KdbpCmdRegs(ULONG Argc, PCHAR Argv[])
Displays CPU registers.
void * memrchr(const void *s, int c, size_t n)
static BOOLEAN KdbUseIntelSyntax
static PKDBG_CLI_ROUTINE KdbCliCallbacks[10]
static KSPIN_LOCK KdpDmesgLogSpinLock
static BOOLEAN KdbpCmdContinue(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
VOID KdbpCliInterpretInitFile(VOID)
Interprets the KDBinit file from the \SystemRoot\System32\drivers\etc directory, that has been loaded...
static BOOLEAN KdbBreakOnModuleLoad
static VOID KdpFilterEscapes(_Inout_ PSTR String)
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
static VOID KdbpPagerInternal(_In_ PCHAR Buffer, _In_ ULONG BufLength, _In_ BOOLEAN DoPage)
Prints the given string with, page by page.
BOOLEAN ExpKdbgExtPool(ULONG Argc, PCHAR Argv[])
static VOID NTAPI KdbDebugPrint(_In_ PCCH String, _In_ ULONG Length)
Debug logger function.
static BOOLEAN KdbpEvaluateExpression(IN PCHAR Expression, IN LONG ErrOffset, OUT PULONGLONG Result)
Evaluates an expression...
static const ULONG KdpDmesgBufferSize
#define NPX_STATE_TO_STRING(state)
BOOLEAN ExpKdbgExtPoolFind(ULONG Argc, PCHAR Argv[])
BOOLEAN KdbpBugCheckRequested
static BOOLEAN KdbpCmdProc(ULONG Argc, PCHAR Argv[])
Lists processes or switches to another process context.
#define Ke386GetGlobalDescriptorTable
static volatile ULONG KdpDmesgCurrentPosition
static BOOLEAN KdbpCmdStep(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
static BOOLEAN KdbpCmdBackTrace(ULONG Argc, PCHAR Argv[])
Displays a backtrace.
static volatile ULONG KdpDmesgFreeBytes
NTSTATUS NTAPI KdbInitialize(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Initializes the KDBG debugger.
VOID KdbpPrintUnicodeString(_In_ PCUNICODE_STRING String)
static BOOLEAN KdbpCmdBreakPoint(ULONG Argc, PCHAR Argv[])
Sets a software or hardware (memory) breakpoint at the given address.
static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[])
Display debug messages on screen, with paging.
BOOLEAN ExpKdbgExtIrpFind(ULONG Argc, PCHAR Argv[])
volatile PCHAR KdbInitFileBuffer
#define Ke386GetLocalDescriptorTable
BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[])
static BOOLEAN KdbpDoCommand(IN PCHAR Command)
Parses command line and executes command if found.
static BOOLEAN KdbpGetComponentId(IN PCSTR ComponentName, OUT PULONG ComponentId)
Retrieves the component ID corresponding to a given component name.
BOOLEAN(* Fn)(ULONG Argc, PCHAR Argv[])
static const struct @1856 KdbDebuggerCommands[]
static BOOLEAN KdbpCmdDisassembleX(ULONG Argc, PCHAR Argv[])
Disassembles 10 instructions at eip or given address or displays 16 dwords from memory at given addre...
static BOOLEAN KdbpCmdPcr(ULONG Argc, PCHAR Argv[])
Displays the KPCR.
static PCHAR KdpDmesgBuffer
static BOOLEAN KdbpCmdFilter(ULONG Argc, PCHAR Argv[])
Displays the list of active debug channels, or enable/disable debug channels.
static BOOLEAN KdbOutputAborted
VOID KdbpPrint(_In_ PSTR Format, _In_ ...)
Prints the given string with printf-like formatting.
static volatile ULONG KdbDmesgTotalWritten
BOOLEAN ExpKdbgExtPoolUsed(ULONG Argc, PCHAR Argv[])
BOOLEAN(NTAPI * PKDBG_CLI_ROUTINE)(IN PCHAR Command, IN ULONG Argc, IN PCH Argv[])
static BOOLEAN KdbpCmdHelp(ULONG Argc, PCHAR Argv[])
Displays help screen.
static BOOLEAN KdbpCmdEvalExpression(ULONG Argc, PCHAR Argv[])
Evaluates an expression and displays the result.
BOOLEAN ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[])
static volatile BOOLEAN KdbpIsInDmesgMode
static BOOLEAN KdbpCmdMod(ULONG Argc, PCHAR Argv[])
Lists loaded modules or the one containing the specified address.
const CSTRING KdbPromptStr
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.
BOOLEAN ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
static BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[])
Bugchecks the system.
static BOOLEAN KdbpCmdSet(ULONG Argc, PCHAR Argv[])
Sets or displays a config variables value.
static BOOLEAN KdbpInvokeCliCallbacks(IN PCHAR Command, IN ULONG Argc, IN PCHAR Argv[])
Invokes registered CLI callbacks until one of them handled the Command.
static ULONG KdbNumberOfColsPrinted
#define KD_DEBUG_PRINT_FILTER(Name)
static BOOLEAN KdbpCmdGdtLdtIdt(ULONG Argc, PCHAR Argv[])
Displays GDT, LDT or IDT.
static BOOLEAN KdbpCmdThread(ULONG Argc, PCHAR Argv[])
Lists threads or switches to another thread context.
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
BOOLEAN NTAPI KdbpGetHexNumber(IN PCHAR pszNum, OUT ULONG_PTR *pulValue)
NTSTATUS KdbpCliInit(VOID)
Called when KDB is initialized.
static BOOLEAN KdbpCmdReboot(ULONG Argc, PCHAR Argv[])
static BOOLEAN LoadSymbols
BOOLEAN KdpUpdateTerminalSize(_Out_ PSIZE TermSize)
BOOLEAN KdpInitTerminal(VOID)
Initializes the controlling terminal.
CHAR KdpReadTermKey(_Out_ PULONG ScanCode)
Reads one character from the terminal. This function returns a scan code even when reading is done fr...
PLOADER_PARAMETER_BLOCK KeLoaderBlock
#define memmove(s1, s2, n)
static const struct op_mask SETUP
#define sprintf(buf, format,...)
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define DPFLTR_WARNING_LEVEL
#define DPFLTR_INFO_LEVEL
#define DBG_STATUS_CONTROL_C
#define DPFLTR_TRACE_LEVEL
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
_In_ ULONG _In_ ULONG _In_ ULONG Length
FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister(PKTRAP_FRAME TrapFrame)
FORCEINLINE ULONG_PTR KeGetContextFrameRegister(PCONTEXT Context)
FORCEINLINE VOID KeSetContextFrameRegister(PCONTEXT Context, ULONG_PTR Frame)
FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister(PKTRAP_FRAME TrapFrame)
#define KeGetContextPc(Context)
#define KeGetTrapFramePc(TrapFrame)
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
LIST_ENTRY PsActiveProcessHead
#define _SEH2_EXCEPT(...)
VOID RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate)
BOOLEAN RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate)
_CRT_RESTORE_GCC_WARNINGS _CRT_DISABLE_GCC_WARNINGS _Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
static const char *const debug_classes[]
#define FileStandardInformation
#define STATUS_END_OF_FILE
PULONG MinorVersion OPTIONAL
base of all file and directory entries
union _KGDTENTRY::@2531 HighWord
struct _KGDTENTRY::@2531::@2533 Bits
struct _KGDTENTRY::@2531::@2532 Bytes
ULONG SecondLevelCacheSize
UCHAR SecondLevelCacheAssociativity
struct _KPRCB * CurrentPrcb
union _KGDTENTRY64 * GdtBase
PKSPIN_LOCK_QUEUE LockArray
union _KIDTENTRY64 * IdtBase
volatile VOID * StackLimit
UNICODE_STRING BaseDllName
struct _LIST_ENTRY * Flink
PVOID ArbitraryUserPointer
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
PROSSYM_AGGREGATE_MEMBER Elements
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_OBJECT_NAME_NOT_FOUND
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
struct _LARGE_INTEGER::@2379 u
PEXCEPTION_ROUTINE NTAPI RtlVirtualUnwind(_In_ ULONG HandlerType, _In_ ULONG64 ImageBase, _In_ ULONG64 ControlPc, _In_ PRUNTIME_FUNCTION FunctionEntry, _Inout_ PCONTEXT Context, _Outptr_ PVOID *HandlerData, _Out_ PULONG64 EstablisherFrame, _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers)
PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry(IN DWORD64 ControlPc, OUT PDWORD64 ImageBase, OUT PUNWIND_HISTORY_TABLE HistoryTable)
Locates the RUNTIME_FUNCTION entry corresponding to a code address. https://learn....
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
#define AMD64_DEBUG_CONTROL_SPACE_KSPECIAL
void int int ULONGLONG int va_list * ap
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
_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
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define ObDereferenceObject