42 #define KEY_SCAN_UP 72 43 #define KEY_SCAN_DOWN 80 46 #define KEYSC_END 0x004f 47 #define KEYSC_PAGEUP 0x0049 48 #define KEYSC_PAGEDOWN 0x0051 49 #define KEYSC_HOME 0x0047 50 #define KEYSC_ARROWUP 0x0048 52 #define KDB_ENTER_CONDITION_TO_STRING(cond) \ 53 ((cond) == KdbDoNotEnter ? "never" : \ 54 ((cond) == KdbEnterAlways ? "always" : \ 55 ((cond) == KdbEnterFromKmode ? "kmode" : "umode"))) 57 #define KDB_ACCESS_TYPE_TO_STRING(type) \ 58 ((type) == KdbAccessRead ? "read" : \ 59 ((type) == KdbAccessWrite ? "write" : \ 60 ((type) == KdbAccessReadWrite ? "rdwr" : "exec"))) 62 #define NPX_STATE_TO_STRING(state) \ 63 ((state) == NPX_STATE_LOADED ? "Loaded" : \ 64 ((state) == NPX_STATE_NOT_LOADED ? "Not loaded" : "Unknown")) 109 #ifndef Ke386GetGlobalDescriptorTable 110 # define Ke386GetGlobalDescriptorTable __sgdt 112 #ifndef Ke386GetLocalDescriptorTable 113 # define Ke386GetLocalDescriptorTable __sldt 170 #define KD_DEBUG_PRINT_FILTER(Name) \ 171 { #Name, DPFLTR_##Name##_ID } 352 #undef KD_DEBUG_PRINT_FILTER 367 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
368 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
369 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
370 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
371 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
372 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
374 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
379 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
380 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
381 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
386 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
387 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
391 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
392 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
396 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
399 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
400 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
402 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.", KdbpCmdTss },
409 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
410 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
411 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
412 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
413 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
414 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
415 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
416 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
419 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
420 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
443 static CHAR ErrMsgBuffer[130] =
"^ ";
444 LONG ExpressionErrOffset = -1;
445 PCHAR ErrMsg = ErrMsgBuffer;
449 &ExpressionErrOffset, ErrMsgBuffer + 2);
452 if (ExpressionErrOffset >= 0)
453 ExpressionErrOffset += ErrOffset;
457 KdbpPrint(
"%*s%s\n", ExpressionErrOffset,
"", ErrMsg);
472 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
476 *pulValue =
strtoul(pszNum, &endptr, 16);
478 return (*endptr ==
'\0');
502 for (
i = 1;
i < Argc;
i++)
512 if (
Result > 0x00000000ffffffffLL)
514 if (
Result & 0x8000000000000000LL)
523 if (ul <= 0xff && ul >= 0x80)
525 else if (ul <= 0xffff && ul >= 0x8000)
531 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
545 KdbpPrintStructInternal
562 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
565 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
569 switch (Member->
Size) {
586 if (Member->
Size < 8) {
589 for (
j = 0;
j < Member->
Size;
j++) {
593 }
else goto readfail;
596 Indent[IndentLen] =
' ';
601 Indent[IndentLen] = 0;
608 if (Member->
Size <= 8) {
612 Indent[IndentLen] =
' ';
614 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
617 Indent[IndentLen] = 0;
637 CHAR Indent[100] = {0};
640 if (Argc < 3)
goto end;
642 AnsiName.
Buffer = Argv[1];
644 Info = KdbpSymFindCachedFile(&ModName);
647 DPRINT1(
"Could not get aggregate\n");
654 PCHAR ArgStart = Argv[3];
655 DPRINT1(
"Trying to get expression\n");
656 for (
i = 3;
i < Argc - 1;
i++)
663 DPRINT1(
"Arg: %s\n", ArgStart);
734 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n" 735 " messages without Component ID and Level.\n" 736 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n" 737 " an unknown Component ID.\n\n");
738 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
739 KdbpPrint(
" Component Name Component ID\n" 740 " ================== ================\n");
748 for (
i = 1;
i < Argc;
i++)
759 if (
len != (
p - opt))
775 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
791 if (*
p ==
'+' || *
p ==
'-')
796 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
823 if (Argv[0][0] ==
'x')
832 if (
strcmp(Argv[Argc-2],
"L") == 0)
841 else if (Argv[Argc-1][0] ==
'L')
853 for (ul = 1; ul < Argc; ul++)
855 Argv[ul][
strlen(Argv[ul])] =
' ';
871 else if (Argv[0][0] ==
'x')
873 KdbpPrint(
"x: Address argument required.\n");
877 if (Argv[0][0] ==
'x')
939 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
940 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
941 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
942 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
943 " BIT23",
" BIT24",
" BIT25",
" BIT26",
944 " BIT27",
" BIT28",
" BIT29",
" BIT30",
947 if (Argv[0][0] ==
'r')
951 "SS:ESP 0x%04x:0x%08x\n" 952 " EAX 0x%08x EBX 0x%08x\n" 953 " ECX 0x%08x EDX 0x%08x\n" 954 " ESI 0x%08x EDI 0x%08x\n" 964 "SS:RSP 0x%04x:0x%p\n" 965 " RAX 0x%p RBX 0x%p\n" 966 " RCX 0x%p RDX 0x%p\n" 967 " RSI 0x%p RDI 0x%p\n" 978 for (
i = 0;
i < 32;
i++)
982 if ((
Context->EFlags & (1 << 1)) == 0)
992 else if ((
Context->EFlags & (1 <<
i)) != 0)
999 else if (Argv[0][0] ==
's')
1001 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
1004 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
1006 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
1008 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
1010 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
1012 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
1017 ASSERT(Argv[0][0] ==
'd');
1049 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1090 (
PVOID)&Tss->Backlink,
1096 return (Backlink != 0 && Backlink != TssSelector);
1100 KdbpContextFromPrevTss(
1119 Tss = KdbpRetrieveTss(Backlink,
NULL, pGdtr);
1138 *TssSelector = Backlink;
1163 if (
strcmp(Argv[Argc-2],
"L") == 0)
1171 else if (Argv[Argc-1][0] ==
'L')
1182 for (ul = 1; ul < Argc; ul++)
1184 Argv[ul][
strlen(Argv[ul])] =
' ';
1192 if (Argv[1][0] ==
'*')
1207 KdbpPrint(
"Thread backtrace not supported yet!\n");
1221 TssSelector = Ke386GetTr();
1222 Tss = KdbpRetrieveTss(TssSelector,
NULL, &Gdtr);
1223 if (KdbpIsNestedTss(TssSelector, Tss))
1226 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1247 goto CheckForParentTSS;
1253 goto CheckForParentTSS;
1257 goto CheckForParentTSS;
1278 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1279 goto CheckForParentTSS;
1293 if (!KdbpIsNestedTss(TssSelector, Tss))
1296 GotNextFrame = KdbpContextFromPrevTss(&
Context, &TssSelector, &Tss, &Gdtr);
1307 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1344 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1349 if (Argv[0][0] ==
'n')
1376 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1408 GlobalOrLocal =
" global";
1419 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1423 ConditionExpr ?
" IF " :
"",
1424 ConditionExpr ? ConditionExpr :
"",
1433 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1435 ConditionExpr ?
" IF " :
"",
1436 ConditionExpr ? ConditionExpr :
"",
1443 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1446 ConditionExpr ?
" IF " :
"",
1447 ConditionExpr ? ConditionExpr :
"",
1469 KdbpPrint(
"%s: argument required\n", Argv[0]);
1474 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1475 if (pend == Argv[1] || *pend !=
'\0')
1477 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1481 if (Argv[0][1] ==
'e')
1485 else if (Argv [0][1] ==
'd')
1491 ASSERT(Argv[0][1] ==
'c');
1508 ULONG AddressArgIndex,
i;
1509 LONG ConditionArgIndex;
1512 if (Argv[0][2] ==
'x')
1516 KdbpPrint(
"bpx: Address argument required.\n");
1520 AddressArgIndex = 1;
1525 ASSERT(Argv[0][2] ==
'm');
1529 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1535 else if (
_stricmp(Argv[1],
"r") == 0)
1537 else if (
_stricmp(Argv[1],
"w") == 0)
1539 else if (
_stricmp(Argv[1],
"rw") == 0)
1543 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1553 AddressArgIndex = 3;
1554 if (
_stricmp(Argv[2],
"byte") == 0)
1556 else if (
_stricmp(Argv[2],
"word") == 0)
1558 else if (
_stricmp(Argv[2],
"dword") == 0)
1567 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1571 if (Argc <= AddressArgIndex)
1573 KdbpPrint(
"bpm: Address argument required.\n");
1581 ConditionArgIndex = -1;
1582 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1584 if (
strcmp(Argv[
i+1],
"IF") == 0)
1586 ConditionArgIndex =
i + 2;
1587 if ((
ULONG)ConditionArgIndex >= Argc)
1589 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1593 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1611 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1616 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1640 "Initialized",
"Ready",
"Running",
1641 "Standby",
"Terminated",
"Waiting",
1642 "Transition",
"DeferredReady" 1647 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1654 if (Argv[2] == pend)
1656 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1662 KdbpPrint(
"thread: Invalid process id!\n");
1667 ReferencedProcess =
TRUE;
1676 KdbpPrint(
"No threads in current process!\n");
1678 if (ReferencedProcess)
1684 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1727 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1742 if (ReferencedProcess)
1745 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1749 KdbpPrint(
"thread attach: thread id argument required!\n");
1754 if (Argv[2] == pend)
1756 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1765 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1774 if (Argv[1] == pend)
1776 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1782 KdbpPrint(
"thread: Invalid thread id!\n");
1787 ReferencedThread =
TRUE;
1797 " State: %s (0x%x)\n" 1799 " Affinity: 0x%08x\n" 1800 " Initial Stack: 0x%08x\n" 1801 " Stack Limit: 0x%08x\n" 1802 " Stack Base: 0x%08x\n" 1803 " Kernel Stack: 0x%08x\n" 1804 " Trap Frame: 0x%08x\n" 1806 " NPX State: %s (0x%x)\n" 1808 , (Argc < 2) ?
"Current Thread:\n" :
"" 1824 if (ReferencedThread)
1845 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1850 KdbpPrint(
"No processes in the system!\n");
1884 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1888 KdbpPrint(
"process attach: process id argument required!\n");
1893 if (Argv[2] == pend)
1895 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
1914 if (Argv[1] == pend)
1916 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
1922 KdbpPrint(
"proc: Invalid process id!\n");
1927 ReferencedProcess =
TRUE;
1934 " State: %s (0x%x)\n" 1935 " Image Filename: %s\n",
1936 (Argc < 2) ?
"Current process:\n" :
"",
1942 if (ReferencedProcess)
1967 Argv[Argc][
strlen(Argv[Argc])] =
' ';
1976 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1986 DisplayOnlyOneModule =
TRUE;
1994 KdbpPrint(
" %08x %08x %s\n", ntoskrnlBase, 0,
"ntoskrnl.exe");
2030 if (Argv[0][0] ==
'i')
2037 KdbpPrint(
"Interrupt descriptor table is empty.\n");
2042 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
2044 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2052 Dpl = ((SegDesc[1] >> 13) & 3);
2053 if ((SegDesc[1] & 0x1f00) == 0x0500)
2054 SegType =
"TASKGATE";
2055 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2056 SegType =
"INTGATE32";
2057 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2058 SegType =
"INTGATE16";
2059 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2060 SegType =
"TRAPGATE32";
2061 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2062 SegType =
"TRAPGATE16";
2064 SegType =
"UNKNOWN";
2066 if ((SegDesc[1] & (1 << 15)) == 0)
2068 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2069 i / 8, SegType, Dpl);
2071 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2073 SegSel = SegDesc[0] >> 16;
2075 i / 8, SegType, SegSel, Dpl);
2079 SegSel = SegDesc[0] >> 16;
2080 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2081 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2082 i / 8, SegType, SegSel, SegBase, Dpl);
2090 if (Argv[0][0] ==
'g')
2098 ASSERT(Argv[0][0] ==
'l');
2109 KdbpPrint(
"%s descriptor table is empty.\n",
2110 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2114 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2115 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2116 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2118 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2126 Dpl = ((SegDesc[1] >> 13) & 3);
2127 Type = ((SegDesc[1] >> 8) & 0xf);
2129 SegBase = SegDesc[0] >> 16;
2130 SegBase |= (SegDesc[1] & 0xff) << 16;
2131 SegBase |= SegDesc[1] & 0xff000000;
2132 SegLimit = SegDesc[0] & 0x0000ffff;
2133 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2135 if ((SegDesc[1] & (1 << 23)) != 0)
2145 if ((SegDesc[1] & (1 << 12)) == 0)
2149 case 1: SegType =
"TSS16(Avl)";
break;
2150 case 2: SegType =
"LDT";
break;
2151 case 3: SegType =
"TSS16(Busy)";
break;
2152 case 4: SegType =
"CALLGATE16";
break;
2153 case 5: SegType =
"TASKGATE";
break;
2154 case 6: SegType =
"INTGATE16";
break;
2155 case 7: SegType =
"TRAPGATE16";
break;
2156 case 9: SegType =
"TSS32(Avl)";
break;
2157 case 11: SegType =
"TSS32(Busy)";
break;
2158 case 12: SegType =
"CALLGATE32";
break;
2159 case 14: SegType =
"INTGATE32";
break;
2160 case 15: SegType =
"TRAPGATE32";
break;
2161 default: SegType =
"UNKNOWN";
break;
2171 else if ((SegDesc[1] & (1 << 11)) == 0)
2173 if ((SegDesc[1] & (1 << 22)) != 0)
2180 if ((SegDesc[1] & (1 << 22)) != 0)
2186 if ((SegDesc[1] & (1 << 15)) == 0)
2188 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2189 i / 8,
i | Dpl | ul, SegType, Dpl);
2193 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2194 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2196 if ((SegDesc[1] & (1 << 12)) == 0)
2200 else if ((SegDesc[1] & (1 << 11)) == 0)
2202 if ((SegDesc[1] & (1 << 10)) != 0)
2205 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2207 if ((SegDesc[1] & (1 << 8)) != 0)
2212 if ((SegDesc[1] & (1 << 10)) != 0)
2215 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2217 if ((SegDesc[1] & (1 << 8)) != 0)
2221 if ((SegDesc[1] & (1 << 20)) != 0)
2241 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2242 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n" 2243 " Tib.StackBase: 0x%08x\n" 2244 " Tib.StackLimit: 0x%08x\n" 2245 " Tib.SubSystemTib: 0x%08x\n" 2246 " Tib.FiberData/Version: 0x%08x\n" 2247 " Tib.ArbitraryUserPointer: 0x%08x\n" 2248 " Tib.Self: 0x%08x\n" 2250 " SelfPcr: 0x%08x\n" 2258 " IrrActive: 0x%08x\n" 2261 " KdVersionBlock: 0x%08x\n" 2267 " MajorVersion: 0x%04x\n" 2268 " MinorVersion: 0x%04x\n" 2270 " SetMember: 0x%08x\n" 2272 " StallScaleFactor: 0x%08x\n" 2276 " L2CacheAssociativity: 0x%02x\n" 2278 " VdmAlert: 0x%08x\n" 2280 " L2CacheSize: 0x%08x\n" 2282 " InterruptMode: 0x%08x\n" 2339 PCHAR Param, pszNext;
2343 if (Argv[1][0] ==
'*')
2346 ulValue =
strtoul(Param, &pszNext, 0);
2347 if (pszNext && *pszNext)
2349 KdbpPrint(
"Invalid TSS specification.\n");
2353 if (Argv[1][0] ==
'*')
2362 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2369 TssSelector = (
USHORT)ulValue;
2370 Tss = KdbpRetrieveTss(TssSelector,
NULL,
NULL);
2373 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2382 TssSelector = Ke386GetTr();
2387 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2388 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2390 " Ss0:Esp0: 0x%04x:0x%08x\n" 2411 " IoMapBase: 0x%04x\n",
2465 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2469 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2487 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2490 KdbpPrint(
"*** Dmesg: end of output ***\n");
2510 static const PCHAR ExceptionNames[21] =
2512 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2513 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2514 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2515 "MACHINECHECK",
"SIMDFAULT",
"OTHERS" 2522 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2523 KdbpPrint(
" break_on_module_load [true|false]\n");
2525 else if (
strcmp(Argv[1],
"syntax") == 0)
2533 if (
_stricmp(Argv[2],
"intel") == 0)
2535 else if (
_stricmp(Argv[2],
"at&t") == 0)
2538 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2541 else if (
strcmp(Argv[1],
"condition") == 0)
2545 KdbpPrint(
"Conditions: (First) (Last)\n");
2548 if (!ExceptionNames[
l])
2557 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2563 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2569 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2577 if (Argv[2] == pend)
2581 if (!ExceptionNames[
l])
2584 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2591 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2598 if (
_stricmp(Argv[3],
"first") == 0)
2600 else if (
_stricmp(Argv[3],
"last") == 0)
2604 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2608 if (
_stricmp(Argv[4],
"never") == 0)
2610 else if (
_stricmp(Argv[4],
"always") == 0)
2612 else if (
_stricmp(Argv[4],
"umode") == 0)
2614 else if (
_stricmp(Argv[4],
"kmode") == 0)
2618 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2625 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2627 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2640 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2641 l, ExceptionNames[
l],
2647 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2654 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2662 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2665 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2670 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2685 KdbpPrint(
"Kernel debugger commands:\n");
2728 LONG RowsPrintedByTerminal;
2737 if (!TerminalInitialized)
2745 TerminalInitialized =
TRUE;
2762 TerminalConnected =
TRUE;
2772 TerminalReportsSize =
FALSE;
2807 TerminalReportsSize =
TRUE;
2835 while (
p[0] !=
'\0')
2845 RowsPrintedByTerminal = 0;
2848 RowsPrintedByTerminal++;
2861 KdpDprintf(
"--- Press q to abort, any other key to continue ---");
2862 RowsPrintedByTerminal++;
2892 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
2903 if (!TerminalConnected)
2953 const unsigned char *
cp;
2957 cp = (
unsigned char *)
s +
n;
2960 if (*(--
cp) == (
unsigned char)
c)
2984 PCHAR p0 = pCurPos - p0len;
2985 PCHAR prev_p = p0, p1;
3035 static CHAR InBuffer[4096];
3043 LONG RowsPrintedByTerminal;
3054 if (!TerminalInitialized)
3062 TerminalInitialized =
TRUE;
3073 if (
Length >= (
sizeof(InBuffer) - 1))
3079 TerminalConnected =
TRUE;
3089 TerminalReportsSize =
FALSE;
3113 if (InBuffer[0] ==
'8' && InBuffer[1] ==
';')
3115 for (
i = 2; (
i <
Length) && (InBuffer[
i] !=
';');
i++);
3124 TerminalReportsSize =
TRUE;
3148 while (
p[0] !=
'\0')
3168 RowsPrintedByTerminal = 0;
3171 RowsPrintedByTerminal++;
3184 KdpDprintf(
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---");
3185 RowsPrintedByTerminal++;
3238 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3249 if (!TerminalConnected)
3380 static CHAR LastCommand[1024];
3381 static CHAR NextKey =
'\0';
3382 INT CmdHistIndex = -1;
3443 if (NextKey ==
'\n' || NextKey == -1)
3482 if (CmdHistIndex < 0)
3488 i = CmdHistIndex - 1;
3523 i = CmdHistIndex + 1;
3651 static PCHAR Argv[256];
3652 static CHAR OrigCommand[1024];
3661 while (*
p ==
'\t' || *
p ==
' ')
3697 KdbpPrint(
"Command '%s' is unknown.\n", OrigCommand);
3712 if (EnteredOnSingleStep)
3791 DPRINT(
"KDB: Executing KDBinit file...\n");
3793 while (p1[0] !=
'\0')
3807 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3808 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3813 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3822 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3825 DPRINT(
"KDB: KDBinit executed\n");
3860 DPRINT(
"Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3865 Status = ZwQueryInformationFile(
hFile, &
Iosb, &FileStdInfo,
sizeof(FileStdInfo),
3870 DPRINT(
"Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3880 DPRINT(
"Could not allocate %d bytes for KDBinit file\n",
FileSize);
3891 DPRINT(
"Could not read KDBinit file into memory (Status 0x%lx)\n",
Status);
BOOLEAN KdbpDeleteBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Deletes a breakpoint.
#define KeGetTrapFramePc(TrapFrame)
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
static BOOLEAN KdbpCmdFilter(ULONG Argc, PCHAR Argv[])
Displays the list of active debug channels, or enable/disable debug channels.
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.
static const struct @1769 KdbDebuggerCommands[]
#define memmove(s1, s2, n)
static VOID KdbpReadCommand(OUT PCHAR Buffer, IN ULONG Size)
Reads a line of user-input.
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
FORCEINLINE VOID KeSetContextFrameRegister(PCONTEXT Context, ULONG_PTR Frame)
void * memrchr(const void *s, int c, size_t n)
static VOID KdbpCommandHistoryAppend(IN PCHAR Command)
Appends a command to the command history.
volatile BOOLEAN KdbpIsInDmesgMode
static PKDBG_CLI_ROUTINE KdbCliCallbacks[10]
_In_ ULONG _In_ ULONG _In_ ULONG Length
#define NPX_STATE_TO_STRING(state)
BOOLEAN KdbSymPrintAddress(IN PVOID Address, IN PCONTEXT Context)
Print address...
static const struct op_mask SETUP
#define COVERAGE(name, NAME, description, tag1, tag2, tag3, tag4)
static BOOLEAN KdbpCmdProc(ULONG Argc, PCHAR Argv[])
Lists processes or switches to another process context.
#define OBJ_CASE_INSENSITIVE
ACPI_SIZE strlen(const char *String)
IN BOOLEAN OUT PSTR Buffer
NTSTATUS NTAPI NtSetDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level, _In_ BOOLEAN State)
BOOLEAN NTAPI KdbpGetHexNumber(IN PCHAR pszNum, OUT ULONG_PTR *pulValue)
#define KdbpGetCharKeyboard(ScanCode)
struct _KGDTENTRY::@2400::@2401 Bytes
static BOOLEAN KdbpEvaluateExpression(IN PCHAR Expression, IN LONG ErrOffset, OUT PULONGLONG Result)
Evaluates an expression...
static BOOLEAN KdbpCmdBreakPointList(ULONG Argc, PCHAR Argv[])
Lists breakpoints.
#define KDB_ACCESS_TYPE_TO_STRING(type)
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
PEPROCESS KdbCurrentProcess
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
UCHAR SecondLevelCacheAssociativity
#define DPFLTR_INFO_LEVEL
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
VOID KdbpPrint(IN PCHAR Format, IN ... OPTIONAL)
Prints the given string with printf-like formatting.
#define Ke386GetLocalDescriptorTable
BOOLEAN RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate)
#define KeGetContextPc(Context)
static BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[])
Bugchecks the system.
_In_ ULONG _In_ ULONG State
#define INVALID_HANDLE_VALUE
#define KD_DEBUG_PRINT_FILTER(Name)
const ULONG KdpDmesgBufferSize
IN PVOID IN PVOID IN USHORT IN USHORT Size
#define KDB_ENTER_CONDITION_TO_STRING(cond)
BOOLEAN ExpKdbgExtPool(ULONG Argc, PCHAR Argv[])
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
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 KdbpGetCharSerial()
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
LIST_ENTRY PsActiveProcessHead
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.
#define OBJ_KERNEL_HANDLE
PVOID ArbitraryUserPointer
#define DPFLTR_WARNING_LEVEL
static BOOLEAN KdbpCmdEnableDisableClearBreakPoint(ULONG Argc, PCHAR Argv[])
Enables, disables or clears a breakpoint.
CHAR KdbpTryGetCharSerial(ULONG Retry)
CHAR KdbpTryGetCharKeyboard(PULONG ScanCode, ULONG Retry)
void Print(USHORT Window, LPSTR p)
volatile ULONG KdbDmesgTotalWritten
static ULONG KdbNumberOfRowsPrinted
#define STATUS_END_OF_FILE
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
#define sprintf(buf, format,...)
static BOOLEAN KdbpDoCommand(IN PCHAR Command)
Parses command line and executes command if found.
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
static BOOLEAN KdbpCmdStep(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
#define FILE_NO_INTERMEDIATE_BUFFERING
static BOOLEAN KdbpCmdContinue(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
static BOOLEAN KdbpCmdMod(ULONG Argc, PCHAR Argv[])
Lists loaded modules or the one containing the specified address.
__INTRIN_INLINE uintptr_t __readeflags(void)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
VOID KdbpCliModuleLoaded(IN PUNICODE_STRING Name)
Called when a module is loaded.
static ULONG KdbNumberOfColsPrinted
__INTRIN_INLINE void __sidt(void *Destination)
FORCEINLINE ULONG_PTR strtoulptr(const char *nptr, char **endptr, int base)
volatile ULONG KdpDmesgCurrentPosition
struct _KGDTENTRY::@2400::@2402 Bits
#define Ke386GetGlobalDescriptorTable
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
static struct @1768 ComponentTable[]
ULONG SecondLevelCacheSize
static BOOLEAN KdbRepeatLastCommand
_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
PCHAR CountOnePageUp(PCHAR Buffer, ULONG BufLength, PCHAR pCurPos)
Calculate pointer position for N lines upper of current position.
_Must_inspect_result_ _In_ WDFDEVICE _In_ ULONG _In_ ACCESS_MASK _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFKEY * Key
static BOOLEAN KdbpCmdHelp(ULONG Argc, PCHAR Argv[])
Displays help screen.
FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister(PKTRAP_FRAME TrapFrame)
static BOOLEAN KdbpCmdBreakPoint(ULONG Argc, PCHAR Argv[])
Sets a software or hardware (memory) breakpoint at the given address.
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
static BOOLEAN KdbpCmdSet(ULONG Argc, PCHAR Argv[])
Sets or displays a config variables value.
BOOLEAN KdbpBugCheckRequested
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
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
PROSSYM_AGGREGATE_MEMBER Elements
BOOLEAN KdbpEnableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Enables a breakpoint.
struct _LIST_ENTRY * Flink
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
static BOOLEAN KdbOutputAborted
static const char *const debug_classes[]
static LONG KdbCommandHistoryBufferIndex
#define NT_SUCCESS(StatCode)
static BOOLEAN KdbBreakOnModuleLoad
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
static BOOLEAN KdbpCmdRegs(ULONG Argc, PCHAR Argv[])
Displays CPU registers.
BOOLEAN ExpKdbgExtPoolFind(ULONG Argc, PCHAR Argv[])
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
static BOOLEAN KdbpCmdThread(ULONG Argc, PCHAR Argv[])
Lists threads or switches to another thread context.
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
static BOOLEAN KdbUseIntelSyntax
#define ObDereferenceObject
static BOOLEAN KdbpCmdReboot(ULONG Argc, PCHAR Argv[])
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
volatile VOID * StackLimit
static LONG KdbNumberOfRowsTerminal
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
#define _strnicmp(_String1, _String2, _MaxCount)
VOID NTAPI HalReturnToFirmware(IN FIRMWARE_REENTRY Action)
static BOOLEAN KdbpCmdDisassembleX(ULONG Argc, PCHAR Argv[])
Disassembles 10 instructions at eip or given address or displays 16 dwords from memory at given addre...
enum _KDB_ACCESS_TYPE KDB_ACCESS_TYPE
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)
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
static LONG KdbNumberOfColsTerminal
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
static BOOLEAN KdbpCmdGdtLdtIdt(ULONG Argc, PCHAR Argv[])
Displays GDT, LDT or IDT.
VOID RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
#define ExAllocatePool(type, size)
#define FILE_NON_DIRECTORY_FILE
#define memcpy(s1, s2, n)
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
VOID KdbpPager(IN PCHAR Buffer, IN ULONG BufLength)
Prints the given string with, page by page.
union _KGDTENTRY::@2400 HighWord
BOOLEAN KdbSingleStepOver
BOOLEAN ExpKdbgExtPoolUsed(ULONG Argc, PCHAR Argv[])
enum _KDB_BREAKPOINT_TYPE KDB_BREAKPOINT_TYPE
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
static BOOLEAN KdbpCmdPcr(ULONG Argc, PCHAR Argv[])
Displays the KPCR.
static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[])
Display debug messages on screen, with paging.
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
static LONG KdbCommandHistoryIndex
BOOLEAN ExpKdbgExtIrpFind(ULONG Argc, PCHAR Argv[])
struct _FileName FileName
NTSTATUS KdbpSafeReadMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
BOOLEAN ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
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.
static PCHAR KdbCommandHistory[sizeof(KdbCommandHistoryBuffer)/8]
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
static BOOLEAN KdbpCmdEvalExpression(ULONG Argc, PCHAR Argv[])
Evaluates an expression and displays the result.
#define DPFLTR_ERROR_LEVEL
BOOLEAN(* Fn)(ULONG Argc, PCHAR Argv[])
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
FORCEINLINE ULONG_PTR KeGetContextFrameRegister(PCONTEXT Context)
UNICODE_STRING BaseDllName
static CHAR KdbCommandHistoryBuffer[2048]
VOID KdbpCliInit(VOID)
Called when KDB is initialized.
#define FileStandardInformation
#define FILE_SYNCHRONOUS_IO_NONALERT
BOOLEAN(NTAPI * PKDBG_CLI_ROUTINE)(IN PCHAR Command, IN ULONG Argc, IN PCH Argv[])
#define DBG_STATUS_CONTROL_C
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
PETHREAD KdbCurrentThread
void int int ULONGLONG int va_list * ap
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
void __cdecl _disable(void)
FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister(PKTRAP_FRAME TrapFrame)
BOOLEAN ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[])
int strcmp(const char *String1, const char *String2)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define InitializeObjectAttributes(p, n, a, r, s)
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
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.
LONG KdbpDisassemble(IN ULONG Address, IN ULONG IntelSyntax)
static BOOLEAN KdbpGetComponentId(IN PCSTR ComponentName, OUT PULONG ComponentId)
Retrieves the component ID corresponding to a given component name.
#define DPFLTR_TRACE_LEVEL
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
static BOOLEAN KdbpInvokeCliCallbacks(IN PCHAR Command, IN ULONG Argc, IN PCHAR Argv[])
Invokes registered CLI callbacks until one of them handled the Command.
struct _LARGE_INTEGER::@2248 u
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
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.
volatile ULONG KdpDmesgFreeBytes
base of all file and directory entries
static BOOLEAN KdbpCmdBackTrace(ULONG Argc, PCHAR Argv[])
Displays a backtrace.
#define RTL_CONSTANT_STRING(s)
PULONG MinorVersion OPTIONAL
BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[])