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")) 148 #define KD_DEBUG_PRINT_FILTER(Name) \ 149 { #Name, DPFLTR_##Name##_ID } 330 #undef KD_DEBUG_PRINT_FILTER 345 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
346 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
347 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
348 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
349 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
350 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
352 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
357 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
358 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
359 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
364 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
365 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
369 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
370 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
374 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
377 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
378 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
379 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.",
KdbpCmdTss },
385 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
386 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
387 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
388 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
389 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
390 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
391 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
392 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
395 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
396 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
419 static CHAR ErrMsgBuffer[130] =
"^ ";
420 LONG ExpressionErrOffset = -1;
421 PCHAR ErrMsg = ErrMsgBuffer;
425 &ExpressionErrOffset, ErrMsgBuffer + 2);
428 if (ExpressionErrOffset >= 0)
429 ExpressionErrOffset += ErrOffset;
433 KdbpPrint(
"%*s%s\n", ExpressionErrOffset,
"", ErrMsg);
448 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
452 *pulValue =
strtoul(pszNum, &endptr, 16);
454 return (*endptr ==
'\0');
478 for (
i = 1;
i < Argc;
i++)
488 if (
Result > 0x00000000ffffffffLL)
490 if (
Result & 0x8000000000000000LL)
499 if (ul <= 0xff && ul >= 0x80)
501 else if (ul <= 0xffff && ul >= 0x8000)
507 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
521 KdbpPrintStructInternal
538 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
541 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
545 switch (Member->
Size) {
562 if (Member->
Size < 8) {
565 for (
j = 0;
j < Member->
Size;
j++) {
569 }
else goto readfail;
572 Indent[IndentLen] =
' ';
577 Indent[IndentLen] = 0;
584 if (Member->
Size <= 8) {
588 Indent[IndentLen] =
' ';
590 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
593 Indent[IndentLen] = 0;
613 CHAR Indent[100] = {0};
616 if (Argc < 3)
goto end;
618 AnsiName.
Buffer = Argv[1];
623 DPRINT1(
"Could not get aggregate\n");
630 PCHAR ArgStart = Argv[3];
631 DPRINT1(
"Trying to get expression\n");
632 for (
i = 3;
i < Argc - 1;
i++)
639 DPRINT1(
"Arg: %s\n", ArgStart);
710 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n" 711 " messages without Component ID and Level.\n" 712 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n" 713 " an unknown Component ID.\n\n");
714 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
715 KdbpPrint(
" Component Name Component ID\n" 716 " ================== ================\n");
724 for (
i = 1;
i < Argc;
i++)
735 if (
len != (
p - opt))
751 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
767 if (*
p ==
'+' || *
p ==
'-')
772 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
799 if (Argv[0][0] ==
'x')
808 if (
strcmp(Argv[Argc-2],
"L") == 0)
817 else if (Argv[Argc-1][0] ==
'L')
829 for (ul = 1; ul < Argc; ul++)
831 Argv[ul][
strlen(Argv[ul])] =
' ';
847 else if (Argv[0][0] ==
'x')
849 KdbpPrint(
"x: Address argument required.\n");
853 if (Argv[0][0] ==
'x')
915 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
916 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
917 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
918 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
919 " BIT23",
" BIT24",
" BIT25",
" BIT26",
920 " BIT27",
" BIT28",
" BIT29",
" BIT30",
923 if (Argv[0][0] ==
'r')
926 "SS:ESP 0x%04x:0x%08x\n" 927 " EAX 0x%08x EBX 0x%08x\n" 928 " ECX 0x%08x EDX 0x%08x\n" 929 " ESI 0x%08x EDI 0x%08x\n" 940 for (
i = 0;
i < 32;
i++)
944 if ((
Context->EFlags & (1 << 1)) == 0)
954 else if ((
Context->EFlags & (1 <<
i)) != 0)
961 else if (Argv[0][0] ==
's')
963 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
966 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
968 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
970 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
972 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
974 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
979 ASSERT(Argv[0][0] ==
'd');
1007 Ke386GetGlobalDescriptorTable(&Gdtr.
Limit);
1010 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1051 (
PVOID)&Tss->Backlink,
1057 return (Backlink != 0 && Backlink != TssSelector);
1099 *TssSelector = Backlink;
1126 if (
strcmp(Argv[Argc-2],
"L") == 0)
1134 else if (Argv[Argc-1][0] ==
'L')
1145 for (ul = 1; ul < Argc; ul++)
1147 Argv[ul][
strlen(Argv[ul])] =
' ';
1155 if (Argv[1][0] ==
'*')
1170 KdbpPrint(
"Thread backtrace not supported yet!\n");
1176 Ke386GetGlobalDescriptorTable(&Gdtr.
Limit);
1179 TssSelector = Ke386GetTr();
1184 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1204 goto CheckForParentTSS;
1210 goto CheckForParentTSS;
1214 goto CheckForParentTSS;
1233 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1234 goto CheckForParentTSS;
1257 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1293 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1298 if (Argv[0][0] ==
'n')
1325 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1357 GlobalOrLocal =
" global";
1368 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1372 ConditionExpr ?
" IF " :
"",
1373 ConditionExpr ? ConditionExpr :
"",
1382 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1384 ConditionExpr ?
" IF " :
"",
1385 ConditionExpr ? ConditionExpr :
"",
1392 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1395 ConditionExpr ?
" IF " :
"",
1396 ConditionExpr ? ConditionExpr :
"",
1418 KdbpPrint(
"%s: argument required\n", Argv[0]);
1423 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1424 if (pend == Argv[1] || *pend !=
'\0')
1426 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1430 if (Argv[0][1] ==
'e')
1434 else if (Argv [0][1] ==
'd')
1440 ASSERT(Argv[0][1] ==
'c');
1457 ULONG AddressArgIndex,
i;
1458 LONG ConditionArgIndex;
1461 if (Argv[0][2] ==
'x')
1465 KdbpPrint(
"bpx: Address argument required.\n");
1469 AddressArgIndex = 1;
1474 ASSERT(Argv[0][2] ==
'm');
1478 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1484 else if (
_stricmp(Argv[1],
"r") == 0)
1486 else if (
_stricmp(Argv[1],
"w") == 0)
1488 else if (
_stricmp(Argv[1],
"rw") == 0)
1492 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1502 AddressArgIndex = 3;
1503 if (
_stricmp(Argv[2],
"byte") == 0)
1505 else if (
_stricmp(Argv[2],
"word") == 0)
1507 else if (
_stricmp(Argv[2],
"dword") == 0)
1516 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1520 if (Argc <= AddressArgIndex)
1522 KdbpPrint(
"bpm: Address argument required.\n");
1530 ConditionArgIndex = -1;
1531 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1533 if (
strcmp(Argv[
i+1],
"IF") == 0)
1535 ConditionArgIndex =
i + 2;
1536 if ((
ULONG)ConditionArgIndex >= Argc)
1538 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1542 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1560 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1565 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1589 "Initialized",
"Ready",
"Running",
1590 "Standby",
"Terminated",
"Waiting",
1591 "Transition",
"DeferredReady" 1596 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1602 ul =
strtoul(Argv[2], &pend, 0);
1603 if (Argv[2] == pend)
1605 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1611 KdbpPrint(
"thread: Invalid process id!\n");
1616 ReferencedProcess =
TRUE;
1623 KdbpPrint(
"No threads in process 0x%08x!\n", ul);
1625 KdbpPrint(
"No threads in current process!\n");
1627 if (ReferencedProcess)
1633 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1680 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1695 if (ReferencedProcess)
1698 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1702 KdbpPrint(
"thread attach: thread id argument required!\n");
1706 ul =
strtoul(Argv[2], &pend, 0);
1707 if (Argv[2] == pend)
1709 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1718 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1726 ul =
strtoul(Argv[1], &pend, 0);
1727 if (Argv[1] == pend)
1729 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1735 KdbpPrint(
"thread: Invalid thread id!\n");
1740 ReferencedThread =
TRUE;
1750 " State: %s (0x%x)\n" 1752 " Affinity: 0x%08x\n" 1753 " Initial Stack: 0x%08x\n" 1754 " Stack Limit: 0x%08x\n" 1755 " Stack Base: 0x%08x\n" 1756 " Kernel Stack: 0x%08x\n" 1757 " Trap Frame: 0x%08x\n" 1758 " NPX State: %s (0x%x)\n",
1759 (Argc < 2) ?
"Current Thread:\n" :
"",
1772 if (ReferencedThread)
1793 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1798 KdbpPrint(
"No processes in the system!\n");
1832 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1836 KdbpPrint(
"process attach: process id argument required!\n");
1840 ul =
strtoul(Argv[2], &pend, 0);
1841 if (Argv[2] == pend)
1843 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
1852 KdbpPrint(
"Attached to process 0x%08x, thread 0x%08x.\n", (
ULONG)ul,
1861 ul =
strtoul(Argv[1], &pend, 0);
1862 if (Argv[1] == pend)
1864 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
1870 KdbpPrint(
"proc: Invalid process id!\n");
1875 ReferencedProcess =
TRUE;
1882 " State: %s (0x%x)\n" 1883 " Image Filename: %s\n",
1884 (Argc < 2) ?
"Current process:\n" :
"",
1890 if (ReferencedProcess)
1915 Argv[Argc][
strlen(Argv[Argc])] =
' ';
1924 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1934 DisplayOnlyOneModule =
TRUE;
1942 KdbpPrint(
" %08x %08x %s\n", ntoskrnlBase, 0,
"ntoskrnl.exe");
1978 if (Argv[0][0] ==
'i')
1985 KdbpPrint(
"Interrupt descriptor table is empty.\n");
1990 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
1992 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2000 Dpl = ((SegDesc[1] >> 13) & 3);
2001 if ((SegDesc[1] & 0x1f00) == 0x0500)
2002 SegType =
"TASKGATE";
2003 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2004 SegType =
"INTGATE32";
2005 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2006 SegType =
"INTGATE16";
2007 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2008 SegType =
"TRAPGATE32";
2009 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2010 SegType =
"TRAPGATE16";
2012 SegType =
"UNKNOWN";
2014 if ((SegDesc[1] & (1 << 15)) == 0)
2016 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2017 i / 8, SegType, Dpl);
2019 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2021 SegSel = SegDesc[0] >> 16;
2023 i / 8, SegType, SegSel, Dpl);
2027 SegSel = SegDesc[0] >> 16;
2028 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2029 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2030 i / 8, SegType, SegSel, SegBase, Dpl);
2038 if (Argv[0][0] ==
'g')
2041 Ke386GetGlobalDescriptorTable(&Reg.
Limit);
2046 ASSERT(Argv[0][0] ==
'l');
2049 Reg.
Limit = Ke386GetLocalDescriptorTable();
2057 KdbpPrint(
"%s descriptor table is empty.\n",
2058 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2062 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2063 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2064 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2066 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2074 Dpl = ((SegDesc[1] >> 13) & 3);
2075 Type = ((SegDesc[1] >> 8) & 0xf);
2077 SegBase = SegDesc[0] >> 16;
2078 SegBase |= (SegDesc[1] & 0xff) << 16;
2079 SegBase |= SegDesc[1] & 0xff000000;
2080 SegLimit = SegDesc[0] & 0x0000ffff;
2081 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2083 if ((SegDesc[1] & (1 << 23)) != 0)
2093 if ((SegDesc[1] & (1 << 12)) == 0)
2097 case 1: SegType =
"TSS16(Avl)";
break;
2098 case 2: SegType =
"LDT";
break;
2099 case 3: SegType =
"TSS16(Busy)";
break;
2100 case 4: SegType =
"CALLGATE16";
break;
2101 case 5: SegType =
"TASKGATE";
break;
2102 case 6: SegType =
"INTGATE16";
break;
2103 case 7: SegType =
"TRAPGATE16";
break;
2104 case 9: SegType =
"TSS32(Avl)";
break;
2105 case 11: SegType =
"TSS32(Busy)";
break;
2106 case 12: SegType =
"CALLGATE32";
break;
2107 case 14: SegType =
"INTGATE32";
break;
2108 case 15: SegType =
"TRAPGATE32";
break;
2109 default: SegType =
"UNKNOWN";
break;
2119 else if ((SegDesc[1] & (1 << 11)) == 0)
2121 if ((SegDesc[1] & (1 << 22)) != 0)
2128 if ((SegDesc[1] & (1 << 22)) != 0)
2134 if ((SegDesc[1] & (1 << 15)) == 0)
2136 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2137 i / 8,
i | Dpl | ul, SegType, Dpl);
2141 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2142 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2144 if ((SegDesc[1] & (1 << 12)) == 0)
2148 else if ((SegDesc[1] & (1 << 11)) == 0)
2150 if ((SegDesc[1] & (1 << 10)) != 0)
2153 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2155 if ((SegDesc[1] & (1 << 8)) != 0)
2160 if ((SegDesc[1] & (1 << 10)) != 0)
2163 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2165 if ((SegDesc[1] & (1 << 8)) != 0)
2169 if ((SegDesc[1] & (1 << 20)) != 0)
2189 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2190 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n" 2191 " Tib.StackBase: 0x%08x\n" 2192 " Tib.StackLimit: 0x%08x\n" 2193 " Tib.SubSystemTib: 0x%08x\n" 2194 " Tib.FiberData/Version: 0x%08x\n" 2195 " Tib.ArbitraryUserPointer: 0x%08x\n" 2196 " Tib.Self: 0x%08x\n" 2197 " SelfPcr: 0x%08x\n" 2201 " IrrActive: 0x%08x\n" 2203 " KdVersionBlock: 0x%08x\n" 2207 " MajorVersion: 0x%04x\n" 2208 " MinorVersion: 0x%04x\n" 2209 " SetMember: 0x%08x\n" 2210 " StallScaleFactor: 0x%08x\n" 2212 " L2CacheAssociativity: 0x%02x\n" 2213 " VdmAlert: 0x%08x\n" 2214 " L2CacheSize: 0x%08x\n" 2215 " InterruptMode: 0x%08x\n",
2243 PCHAR Param, pszNext;
2247 if (Argv[1][0] ==
'*')
2250 ulValue =
strtoul(Param, &pszNext, 0);
2251 if (pszNext && *pszNext)
2253 KdbpPrint(
"Invalid TSS specification.\n");
2257 if (Argv[1][0] ==
'*')
2266 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2273 TssSelector = (
USHORT)ulValue;
2277 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2286 TssSelector = Ke386GetTr();
2291 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2292 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2294 " Ss0:Esp0: 0x%04x:0x%08x\n" 2315 " IoMapBase: 0x%04x\n",
2368 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2372 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2390 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2393 KdbpPrint(
"*** Dmesg: end of output ***\n");
2413 static const PCHAR ExceptionNames[21] =
2415 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2416 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2417 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2418 "MACHINECHECK",
"SIMDFAULT",
"OTHERS" 2425 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2426 KdbpPrint(
" break_on_module_load [true|false]\n");
2428 else if (
strcmp(Argv[1],
"syntax") == 0)
2436 if (
_stricmp(Argv[2],
"intel") == 0)
2438 else if (
_stricmp(Argv[2],
"at&t") == 0)
2441 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2444 else if (
strcmp(Argv[1],
"condition") == 0)
2448 KdbpPrint(
"Conditions: (First) (Last)\n");
2451 if (!ExceptionNames[
l])
2460 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2466 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2472 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2480 if (Argv[2] == pend)
2484 if (!ExceptionNames[
l])
2487 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2494 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2501 if (
_stricmp(Argv[3],
"first") == 0)
2503 else if (
_stricmp(Argv[3],
"last") == 0)
2507 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2511 if (
_stricmp(Argv[4],
"never") == 0)
2513 else if (
_stricmp(Argv[4],
"always") == 0)
2515 else if (
_stricmp(Argv[4],
"umode") == 0)
2517 else if (
_stricmp(Argv[4],
"kmode") == 0)
2521 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2528 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2530 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2543 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2544 l, ExceptionNames[
l],
2550 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2557 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2565 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2568 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2573 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2588 KdbpPrint(
"Kernel debugger commands:\n");
2630 LONG RowsPrintedByTerminal;
2639 if (!TerminalInitialized)
2647 TerminalInitialized =
TRUE;
2664 TerminalConnected =
TRUE;
2674 TerminalReportsSize =
FALSE;
2709 TerminalReportsSize =
TRUE;
2737 while (
p[0] !=
'\0')
2747 RowsPrintedByTerminal = 0;
2750 RowsPrintedByTerminal++;
2763 DbgPrint(
"--- Press q to abort, any other key to continue ---");
2764 RowsPrintedByTerminal++;
2794 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
2805 if (!TerminalConnected)
2855 const unsigned char *
cp;
2859 cp = (
unsigned char *)
s +
n;
2862 if (*(--
cp) == (
unsigned char)
c)
2886 PCHAR p0 = pCurPos - p0len;
2887 PCHAR prev_p = p0, p1;
2937 static CHAR InBuffer[4096];
2945 LONG RowsPrintedByTerminal;
2956 if (!TerminalInitialized)
2964 TerminalInitialized =
TRUE;
2975 if (
Length >= (
sizeof(InBuffer) - 1))
2981 TerminalConnected =
TRUE;
2991 TerminalReportsSize =
FALSE;
3015 if (InBuffer[0] ==
'8' && InBuffer[1] ==
';')
3017 for (
i = 2; (
i <
Length) && (InBuffer[
i] !=
';');
i++);
3026 TerminalReportsSize =
TRUE;
3050 while (
p[0] !=
'\0')
3054 DbgPrint(
"Dmesg: error, p > Buffer+BufLength,d=%d",
p - (
Buffer+BufLength));
3070 RowsPrintedByTerminal = 0;
3073 RowsPrintedByTerminal++;
3086 DbgPrint(
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---");
3087 RowsPrintedByTerminal++;
3140 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3151 if (!TerminalConnected)
3282 static CHAR LastCommand[1024];
3283 static CHAR NextKey =
'\0';
3284 INT CmdHistIndex = -1;
3345 if (NextKey ==
'\n' || NextKey == -1)
3384 if (CmdHistIndex < 0)
3390 i = CmdHistIndex - 1;
3425 i = CmdHistIndex + 1;
3553 static PCHAR Argv[256];
3554 static CHAR OrigCommand[1024];
3563 while (*
p ==
'\t' || *
p ==
' ')
3599 KdbpPrint(
"Command '%s' is unknown.\n", OrigCommand);
3614 if (EnteredOnSingleStep)
3693 DPRINT(
"KDB: Executing KDBinit file...\n");
3695 while (p1[0] !=
'\0')
3709 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3710 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3715 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3724 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3727 DPRINT(
"KDB: KDBinit executed\n");
3762 DPRINT(
"Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3767 Status = ZwQueryInformationFile(
hFile, &
Iosb, &FileStdInfo,
sizeof(FileStdInfo),
3772 DPRINT(
"Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3782 DPRINT(
"Could not allocate %d bytes for KDBinit file\n",
FileSize);
3793 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.
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.
#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)
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)
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.
BOOLEAN RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate)
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
static struct @1808 ComponentTable[]
#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)
static PKTSS KdbpRetrieveTss(IN USHORT TssSelector, OUT PULONG pType OPTIONAL, IN PKDESCRIPTOR pGdtr OPTIONAL)
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.
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)
volatile ULONG KdpDmesgCurrentPosition
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
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.
static const struct @1809 KdbDebuggerCommands[]
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)
struct _LARGE_INTEGER::@2284 u
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
static BOOLEAN KdbpCmdTss(ULONG Argc, PCHAR Argv[])
Displays the TSS.
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 PROSSYM_INFO KdbpSymFindCachedFile(IN PUNICODE_STRING FileName)
Find cached symbol file.
static BOOLEAN KdbBreakOnModuleLoad
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.
union _KGDTENTRY::@2415 HighWord
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
static BOOLEAN KdbUseIntelSyntax
#define ObDereferenceObject
struct _KGDTENTRY::@2415::@2417 Bits
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...
static BOOLEAN KdbpContextFromPrevTss(IN OUT PCONTEXT Context, OUT PUSHORT TssSelector, IN OUT PKTSS *pTss, IN PKDESCRIPTOR pGdtr)
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.
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
ULONG PreviousPreviousMode
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 BOOLEAN KdbpIsNestedTss(IN USHORT TssSelector, IN PKTSS Tss)
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)
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.
struct _KGDTENTRY::@2415::@2416 Bytes
#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.
VOID NTAPI KeStallExecutionProcessor(IN ULONG MicroSeconds)
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN LPCWSTR Name OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
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[])