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")) 111 #ifndef Ke386GetGlobalDescriptorTable 112 # define Ke386GetGlobalDescriptorTable __sgdt 114 #ifndef Ke386GetLocalDescriptorTable 115 # define Ke386GetLocalDescriptorTable __sldt 172 #define KD_DEBUG_PRINT_FILTER(Name) \ 173 { #Name, DPFLTR_##Name##_ID } 354 #undef KD_DEBUG_PRINT_FILTER 369 #ifdef _M_IX86 // FIXME: this is broken on x64 370 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
372 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
373 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
374 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
375 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
376 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
378 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
382 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
383 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
384 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
389 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
390 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
394 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
395 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
399 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
402 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
403 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
405 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.", KdbpCmdTss },
412 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
413 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
414 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
415 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
416 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
417 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
418 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
419 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
422 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
423 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
446 static CHAR ErrMsgBuffer[130] =
"^ ";
447 LONG ExpressionErrOffset = -1;
448 PCHAR ErrMsg = ErrMsgBuffer;
452 &ExpressionErrOffset, ErrMsgBuffer + 2);
455 if (ExpressionErrOffset >= 0)
456 ExpressionErrOffset += ErrOffset;
460 KdbpPrint(
"%*s%s\n", ExpressionErrOffset,
"", ErrMsg);
475 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
479 *pulValue =
strtoul(pszNum, &endptr, 16);
481 return (*endptr ==
'\0');
506 for (
i = 1;
i < Argc;
i++)
516 if (
Result > 0x00000000ffffffffLL)
518 if (
Result & 0x8000000000000000LL)
527 if (ul <= 0xff && ul >= 0x80)
529 else if (ul <= 0xffff && ul >= 0x8000)
535 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
549 KdbpPrintStructInternal
566 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
571 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
577 switch (Member->
Size) {
594 if (Member->
Size < 8) {
597 for (
j = 0;
j < Member->
Size;
j++) {
601 }
else goto readfail;
604 Indent[IndentLen] =
' ';
609 Indent[IndentLen] = 0;
616 if (Member->
Size <= 8) {
620 Indent[IndentLen] =
' ';
622 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
625 Indent[IndentLen] = 0;
645 CHAR Indent[100] = {0};
648 if (Argc < 3)
goto end;
650 AnsiName.
Buffer = Argv[1];
652 Info = KdbpSymFindCachedFile(&ModName);
655 DPRINT1(
"Could not get aggregate\n");
662 PCHAR ArgStart = Argv[3];
663 DPRINT1(
"Trying to get expression\n");
664 for (
i = 3;
i < Argc - 1;
i++)
671 DPRINT1(
"Arg: %s\n", ArgStart);
742 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n" 743 " messages without Component ID and Level.\n" 744 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n" 745 " an unknown Component ID.\n\n");
746 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
747 KdbpPrint(
" Component Name Component ID\n" 748 " ================== ================\n");
756 for (
i = 1;
i < Argc;
i++)
767 if (
len != (
p - opt))
783 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
799 if (*
p ==
'+' || *
p ==
'-')
804 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
831 if (Argv[0][0] ==
'x')
840 if (
strcmp(Argv[Argc-2],
"L") == 0)
849 else if (Argv[Argc-1][0] ==
'L')
861 for (ul = 1; ul < Argc; ul++)
863 Argv[ul][
strlen(Argv[ul])] =
' ';
879 else if (Argv[0][0] ==
'x')
881 KdbpPrint(
"x: Address argument required.\n");
885 if (Argv[0][0] ==
'x')
947 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
948 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
949 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
950 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
951 " BIT23",
" BIT24",
" BIT25",
" BIT26",
952 " BIT27",
" BIT28",
" BIT29",
" BIT30",
955 if (Argv[0][0] ==
'r')
959 "SS:ESP 0x%04x:0x%08x\n" 960 " EAX 0x%08x EBX 0x%08x\n" 961 " ECX 0x%08x EDX 0x%08x\n" 962 " ESI 0x%08x EDI 0x%08x\n" 972 "SS:RSP 0x%04x:0x%p\n" 973 " RAX 0x%p RBX 0x%p\n" 974 " RCX 0x%p RDX 0x%p\n" 975 " RSI 0x%p RDI 0x%p\n" 986 for (
i = 0;
i < 32;
i++)
990 if ((
Context->EFlags & (1 << 1)) == 0)
1000 else if ((
Context->EFlags & (1 <<
i)) != 0)
1007 else if (Argv[0][0] ==
's')
1009 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
1012 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
1014 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
1016 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
1018 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
1020 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
1025 ASSERT(Argv[0][0] ==
'd');
1057 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1102 (
PVOID)&Tss->Backlink,
1109 return (Backlink != 0 && Backlink != TssSelector);
1113 KdbpContextFromPrevTss(
1136 Tss = KdbpRetrieveTss(Backlink,
NULL, pGdtr);
1155 *TssSelector = Backlink;
1179 if (FunctionEntry ==
NULL)
1231 GotNextFrame = GetNextFrame(&
Context);
1259 if (
strcmp(Argv[Argc-2],
"L") == 0)
1267 else if (Argv[Argc-1][0] ==
'L')
1278 for (ul = 1; ul < Argc; ul++)
1280 Argv[ul][
strlen(Argv[ul])] =
' ';
1288 if (Argv[1][0] ==
'*')
1303 KdbpPrint(
"Thread backtrace not supported yet!\n");
1317 TssSelector = Ke386GetTr();
1318 Tss = KdbpRetrieveTss(TssSelector,
NULL, &Gdtr);
1319 if (KdbpIsNestedTss(TssSelector, Tss))
1322 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1343 goto CheckForParentTSS;
1349 goto CheckForParentTSS;
1353 goto CheckForParentTSS;
1374 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1375 goto CheckForParentTSS;
1389 if (!KdbpIsNestedTss(TssSelector, Tss))
1392 GotNextFrame = KdbpContextFromPrevTss(&
Context, &TssSelector, &Tss, &Gdtr);
1403 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1442 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1447 if (Argv[0][0] ==
'n')
1474 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1506 GlobalOrLocal =
" global";
1517 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1521 ConditionExpr ?
" IF " :
"",
1522 ConditionExpr ? ConditionExpr :
"",
1531 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1533 ConditionExpr ?
" IF " :
"",
1534 ConditionExpr ? ConditionExpr :
"",
1541 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1544 ConditionExpr ?
" IF " :
"",
1545 ConditionExpr ? ConditionExpr :
"",
1567 KdbpPrint(
"%s: argument required\n", Argv[0]);
1572 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1573 if (pend == Argv[1] || *pend !=
'\0')
1575 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1579 if (Argv[0][1] ==
'e')
1583 else if (Argv [0][1] ==
'd')
1589 ASSERT(Argv[0][1] ==
'c');
1606 ULONG AddressArgIndex,
i;
1607 LONG ConditionArgIndex;
1610 if (Argv[0][2] ==
'x')
1614 KdbpPrint(
"bpx: Address argument required.\n");
1618 AddressArgIndex = 1;
1623 ASSERT(Argv[0][2] ==
'm');
1627 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1633 else if (
_stricmp(Argv[1],
"r") == 0)
1635 else if (
_stricmp(Argv[1],
"w") == 0)
1637 else if (
_stricmp(Argv[1],
"rw") == 0)
1641 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1651 AddressArgIndex = 3;
1652 if (
_stricmp(Argv[2],
"byte") == 0)
1654 else if (
_stricmp(Argv[2],
"word") == 0)
1656 else if (
_stricmp(Argv[2],
"dword") == 0)
1665 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1669 if (Argc <= AddressArgIndex)
1671 KdbpPrint(
"bpm: Address argument required.\n");
1679 ConditionArgIndex = -1;
1680 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1682 if (
strcmp(Argv[
i+1],
"IF") == 0)
1684 ConditionArgIndex =
i + 2;
1685 if ((
ULONG)ConditionArgIndex >= Argc)
1687 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1691 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1709 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1714 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1738 "Initialized",
"Ready",
"Running",
1739 "Standby",
"Terminated",
"Waiting",
1740 "Transition",
"DeferredReady" 1745 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1752 if (Argv[2] == pend)
1754 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1760 KdbpPrint(
"thread: Invalid process id!\n");
1765 ReferencedProcess =
TRUE;
1774 KdbpPrint(
"No threads in current process!\n");
1776 if (ReferencedProcess)
1782 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1825 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1840 if (ReferencedProcess)
1843 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1847 KdbpPrint(
"thread attach: thread id argument required!\n");
1852 if (Argv[2] == pend)
1854 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1863 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1872 if (Argv[1] == pend)
1874 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1880 KdbpPrint(
"thread: Invalid thread id!\n");
1885 ReferencedThread =
TRUE;
1895 " State: %s (0x%x)\n" 1897 " Affinity: 0x%08x\n" 1898 " Initial Stack: 0x%08x\n" 1899 " Stack Limit: 0x%08x\n" 1900 " Stack Base: 0x%08x\n" 1901 " Kernel Stack: 0x%08x\n" 1902 " Trap Frame: 0x%08x\n" 1904 " NPX State: %s (0x%x)\n" 1906 , (Argc < 2) ?
"Current Thread:\n" :
"" 1922 if (ReferencedThread)
1943 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1948 KdbpPrint(
"No processes in the system!\n");
1982 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1986 KdbpPrint(
"process attach: process id argument required!\n");
1991 if (Argv[2] == pend)
1993 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
2012 if (Argv[1] == pend)
2014 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
2020 KdbpPrint(
"proc: Invalid process id!\n");
2025 ReferencedProcess =
TRUE;
2032 " State: %s (0x%x)\n" 2033 " Image Filename: %s\n",
2034 (Argc < 2) ?
"Current process:\n" :
"",
2040 if (ReferencedProcess)
2065 Argv[Argc][
strlen(Argv[Argc])] =
' ';
2074 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
2084 DisplayOnlyOneModule =
TRUE;
2092 KdbpPrint(
" %p %08x %s\n", (
PVOID)ntoskrnlBase, 0,
"ntoskrnl.exe");
2130 if (Argv[0][0] ==
'i')
2137 KdbpPrint(
"Interrupt descriptor table is empty.\n");
2142 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
2144 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2152 Dpl = ((SegDesc[1] >> 13) & 3);
2153 if ((SegDesc[1] & 0x1f00) == 0x0500)
2154 SegType =
"TASKGATE";
2155 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2156 SegType =
"INTGATE32";
2157 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2158 SegType =
"INTGATE16";
2159 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2160 SegType =
"TRAPGATE32";
2161 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2162 SegType =
"TRAPGATE16";
2164 SegType =
"UNKNOWN";
2166 if ((SegDesc[1] & (1 << 15)) == 0)
2168 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2169 i / 8, SegType, Dpl);
2171 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2173 SegSel = SegDesc[0] >> 16;
2175 i / 8, SegType, SegSel, Dpl);
2179 SegSel = SegDesc[0] >> 16;
2180 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2181 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2182 i / 8, SegType, SegSel, SegBase, Dpl);
2190 if (Argv[0][0] ==
'g')
2198 ASSERT(Argv[0][0] ==
'l');
2209 KdbpPrint(
"%s descriptor table is empty.\n",
2210 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2214 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2215 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2216 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2218 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2226 Dpl = ((SegDesc[1] >> 13) & 3);
2227 Type = ((SegDesc[1] >> 8) & 0xf);
2229 SegBase = SegDesc[0] >> 16;
2230 SegBase |= (SegDesc[1] & 0xff) << 16;
2231 SegBase |= SegDesc[1] & 0xff000000;
2232 SegLimit = SegDesc[0] & 0x0000ffff;
2233 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2235 if ((SegDesc[1] & (1 << 23)) != 0)
2245 if ((SegDesc[1] & (1 << 12)) == 0)
2249 case 1: SegType =
"TSS16(Avl)";
break;
2250 case 2: SegType =
"LDT";
break;
2251 case 3: SegType =
"TSS16(Busy)";
break;
2252 case 4: SegType =
"CALLGATE16";
break;
2253 case 5: SegType =
"TASKGATE";
break;
2254 case 6: SegType =
"INTGATE16";
break;
2255 case 7: SegType =
"TRAPGATE16";
break;
2256 case 9: SegType =
"TSS32(Avl)";
break;
2257 case 11: SegType =
"TSS32(Busy)";
break;
2258 case 12: SegType =
"CALLGATE32";
break;
2259 case 14: SegType =
"INTGATE32";
break;
2260 case 15: SegType =
"TRAPGATE32";
break;
2261 default: SegType =
"UNKNOWN";
break;
2271 else if ((SegDesc[1] & (1 << 11)) == 0)
2273 if ((SegDesc[1] & (1 << 22)) != 0)
2280 if ((SegDesc[1] & (1 << 22)) != 0)
2286 if ((SegDesc[1] & (1 << 15)) == 0)
2288 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2289 i / 8,
i | Dpl | ul, SegType, Dpl);
2293 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2294 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2296 if ((SegDesc[1] & (1 << 12)) == 0)
2300 else if ((SegDesc[1] & (1 << 11)) == 0)
2302 if ((SegDesc[1] & (1 << 10)) != 0)
2305 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2307 if ((SegDesc[1] & (1 << 8)) != 0)
2312 if ((SegDesc[1] & (1 << 10)) != 0)
2315 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2317 if ((SegDesc[1] & (1 << 8)) != 0)
2321 if ((SegDesc[1] & (1 << 20)) != 0)
2341 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2343 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n" 2344 " Tib.StackBase: 0x%08x\n" 2345 " Tib.StackLimit: 0x%08x\n" 2346 " Tib.SubSystemTib: 0x%08x\n" 2347 " Tib.FiberData/Version: 0x%08x\n" 2348 " Tib.ArbitraryUserPointer: 0x%08x\n" 2349 " Tib.Self: 0x%08x\n" 2350 " SelfPcr: 0x%08x\n" 2354 " IrrActive: 0x%08x\n" 2356 " KdVersionBlock: 0x%08x\n" 2360 " MajorVersion: 0x%04x\n" 2361 " MinorVersion: 0x%04x\n" 2362 " SetMember: 0x%08x\n" 2363 " StallScaleFactor: 0x%08x\n" 2365 " L2CacheAssociativity: 0x%02x\n" 2366 " VdmAlert: 0x%08x\n" 2367 " L2CacheSize: 0x%08x\n" 2368 " InterruptMode: 0x%08x\n" 2424 PCHAR Param, pszNext;
2428 if (Argv[1][0] ==
'*')
2431 ulValue =
strtoul(Param, &pszNext, 0);
2432 if (pszNext && *pszNext)
2434 KdbpPrint(
"Invalid TSS specification.\n");
2438 if (Argv[1][0] ==
'*')
2447 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2454 TssSelector = (
USHORT)ulValue;
2455 Tss = KdbpRetrieveTss(TssSelector,
NULL,
NULL);
2458 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2467 TssSelector = Ke386GetTr();
2472 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2473 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2475 " Ss0:Esp0: 0x%04x:0x%08x\n" 2496 " IoMapBase: 0x%04x\n",
2544 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2548 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2566 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2569 KdbpPrint(
"*** Dmesg: end of output ***\n");
2589 static const PCHAR ExceptionNames[21] =
2591 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2592 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2593 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2594 "MACHINECHECK",
"SIMDFAULT",
"OTHERS" 2601 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2602 KdbpPrint(
" break_on_module_load [true|false]\n");
2604 else if (
strcmp(Argv[1],
"syntax") == 0)
2612 if (
_stricmp(Argv[2],
"intel") == 0)
2614 else if (
_stricmp(Argv[2],
"at&t") == 0)
2617 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2620 else if (
strcmp(Argv[1],
"condition") == 0)
2624 KdbpPrint(
"Conditions: (First) (Last)\n");
2627 if (!ExceptionNames[
l])
2636 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2642 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2648 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2656 if (Argv[2] == pend)
2660 if (!ExceptionNames[
l])
2663 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2670 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2677 if (
_stricmp(Argv[3],
"first") == 0)
2679 else if (
_stricmp(Argv[3],
"last") == 0)
2683 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2687 if (
_stricmp(Argv[4],
"never") == 0)
2689 else if (
_stricmp(Argv[4],
"always") == 0)
2691 else if (
_stricmp(Argv[4],
"umode") == 0)
2693 else if (
_stricmp(Argv[4],
"kmode") == 0)
2697 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2704 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2706 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2719 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2720 l, ExceptionNames[
l],
2726 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2733 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2741 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2744 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2749 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2764 KdbpPrint(
"Kernel debugger commands:\n");
2793 const unsigned char *
cp;
2797 cp = (
unsigned char *)
s +
n;
2800 if (*(--
cp) == (
unsigned char)
c)
2827 PCCH p0 = pCurPos - p0len;
2828 PCCH prev_p = p0, p1;
2903 static CHAR InBuffer[128];
2912 LONG RowsPrintedByTerminal;
2922 if (!TerminalInitialized)
2924 TerminalInitialized =
TRUE;
2949 TerminalConnected =
TRUE;
2971 if (SerialTerminal && TerminalConnected && TerminalReportsSize)
2974 TerminalReportsSize =
FALSE;
2997 if (InBuffer[0] ==
'8' && InBuffer[1] ==
';')
2999 for (
i = 2; (
i <
Length) && (InBuffer[
i] !=
';');
i++);
3001 if (InBuffer[
i] ==
';')
3003 InBuffer[
i++] =
'\0';
3008 TerminalReportsSize =
TRUE;
3040 while (
p[0] !=
'\0')
3046 KdpDprintf(
"Dmesg: error, p > Buffer+BufLength,d=%d",
p - (
Buffer + BufLength));
3064 RowsPrintedByTerminal = 0;
3067 RowsPrintedByTerminal++;
3082 KdpDprintf(
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---");
3086 KdpDprintf(
"--- Press q to abort, any other key to continue ---");
3088 RowsPrintedByTerminal++;
3152 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3164 if (!TerminalConnected)
3359 static CHAR LastCommand[1024];
3360 static CHAR NextKey =
'\0';
3361 INT CmdHistIndex = -1;
3408 if ((
Key ==
'\r') || (
Key ==
'\n'))
3423 if (NextKey ==
'\n' || NextKey == -1)
3463 if (CmdHistIndex < 0)
3469 i = CmdHistIndex - 1;
3504 i = CmdHistIndex + 1;
3636 static PCHAR Argv[256];
3637 static CHAR OrigCommand[1024];
3646 while (*
p ==
'\t' || *
p ==
' ')
3682 KdbpPrint(
"Command '%s' is unknown.\n", OrigCommand);
3697 if (EnteredOnSingleStep)
3761 DPRINT(
"KDB: Executing KDBinit file...\n");
3763 while (p1[0] !=
'\0')
3777 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3778 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3783 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3792 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3795 DPRINT(
"KDB: KDBinit executed\n");
3830 DPRINT(
"Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3835 Status = ZwQueryInformationFile(
hFile, &
Iosb, &FileStdInfo,
sizeof(FileStdInfo),
3840 DPRINT(
"Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3850 DPRINT(
"Could not allocate %d bytes for KDBinit file\n",
FileSize);
3861 DPRINT(
"Could not read KDBinit file into memory (Status 0x%lx)\n",
Status);
struct _LARGE_INTEGER::@2253 u
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.
#define memmove(s1, s2, n)
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)
VOID KdbpPager(_In_ PCHAR Buffer, _In_ ULONG BufLength)
Prints the given string with, page by page.
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
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
union _KGDTENTRY64 * GdtBase
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)
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)
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)
#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.
SIZE_T KdbpReadCommand(_Out_ PCHAR Buffer, _In_ SIZE_T Size)
Reads a line of user input from the terminal.
_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[])
static const struct @1774 KdbDebuggerCommands[]
_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
VOID KdbpPrintUnicodeString(_In_ PCUNICODE_STRING String)
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
LONG KdbpDisassemble(IN ULONG_PTR Address, IN ULONG IntelSyntax)
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.
KDP_DEBUG_MODE KdpDebugMode
#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
VOID KdbpPrint(_In_ PSTR Format, _In_ ...)
Prints the given string with printf-like formatting.
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)
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
static ULONG KdbNumberOfColsPrinted
static VOID KdpFilterEscapes(_Inout_ PSTR String)
__INTRIN_INLINE void __sidt(void *Destination)
FORCEINLINE ULONG_PTR strtoulptr(const char *nptr, char **endptr, int base)
volatile ULONG KdpDmesgCurrentPosition
#define Ke386GetGlobalDescriptorTable
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
struct _KPRCB * CurrentPrcb
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
_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 struct @1773 ComponentTable[]
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...
VOID KdbpPagerInternal(_In_ PCHAR Buffer, _In_ ULONG BufLength, _In_ BOOLEAN DoPage)
Prints the given string with, page by page.
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
struct _KGDTENTRY::@2405::@2406 Bytes
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
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 PCHAR CountOnePageUp(_In_ PCCH Buffer, _In_ ULONG BufLength, _In_ PCCH pCurPos)
Calculate pointer position for N lines upper of current position.
static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[])
Display debug messages on screen, with paging.
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
union _KIDTENTRY64 * IdtBase
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[])
_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)
struct _KGDTENTRY::@2405::@2407 Bits
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)
#define _SEH2_EXCEPT(...)
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.
static BOOLEAN KdbpGetComponentId(IN PCSTR ComponentName, OUT PULONG ComponentId)
Retrieves the component ID corresponding to a given component name.
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. http://msdn.microsoft....
#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 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.
PKSPIN_LOCK_QUEUE LockArray
union _KGDTENTRY::@2405 HighWord
#define UNW_FLAG_NHANDLER
#define RTL_CONSTANT_STRING(s)
PULONG MinorVersion OPTIONAL
BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[])