34#include "../kd/kdterminal.h"
41#define KDB_ENTER_CONDITION_TO_STRING(cond) \
42 ((cond) == KdbDoNotEnter ? "never" : \
43 ((cond) == KdbEnterAlways ? "always" : \
44 ((cond) == KdbEnterFromKmode ? "kmode" : "umode")))
46#define KDB_ACCESS_TYPE_TO_STRING(type) \
47 ((type) == KdbAccessRead ? "read" : \
48 ((type) == KdbAccessWrite ? "write" : \
49 ((type) == KdbAccessReadWrite ? "rdwr" : "exec")))
51#define NPX_STATE_TO_STRING(state) \
52 ((state) == NPX_STATE_LOADED ? "Loaded" : \
53 ((state) == NPX_STATE_NOT_LOADED ? "Not loaded" : "Unknown"))
100#ifndef Ke386GetGlobalDescriptorTable
101# define Ke386GetGlobalDescriptorTable __sgdt
103#ifndef Ke386GetLocalDescriptorTable
104# define Ke386GetLocalDescriptorTable __sldt
154#define KD_DEBUG_PRINT_FILTER(Name) \
155 { #Name, DPFLTR_##Name##_ID }
336#undef KD_DEBUG_PRINT_FILTER
352 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
354 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
355 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
356 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
357 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
358 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
360 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
364 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
365 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
366 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
371 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
372 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
376 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
377 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
381 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
384 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
385 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
387 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.", KdbpCmdTss },
394 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
395 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
396 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
397 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
398 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
399 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
400 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
401 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
404 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
405 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
428 static CHAR ErrMsgBuffer[130] =
"^ ";
429 LONG ExpressionErrOffset = -1;
434 &ExpressionErrOffset, ErrMsgBuffer + 2);
437 if (ExpressionErrOffset >= 0)
438 ExpressionErrOffset += ErrOffset;
457 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
461 *pulValue =
strtoul(pszNum, &endptr, 16);
463 return (*endptr ==
'\0');
488 for (
i = 1;
i < Argc;
i++)
498 if (
Result > 0x00000000ffffffffLL)
500 if (
Result & 0x8000000000000000LL)
509 if (ul <= 0xff && ul >= 0x80)
511 else if (ul <= 0xffff && ul >= 0x8000)
517 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
531KdbpPrintStructInternal
548 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
553 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
559 switch (Member->
Size) {
576 if (Member->
Size < 8) {
579 for (
j = 0;
j < Member->
Size;
j++) {
583 }
else goto readfail;
586 Indent[IndentLen] =
' ';
591 Indent[IndentLen] = 0;
598 if (Member->
Size <= 8) {
602 Indent[IndentLen] =
' ';
604 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
607 Indent[IndentLen] = 0;
627 CHAR Indent[100] = {0};
630 if (Argc < 3)
goto end;
632 AnsiName.
Buffer = Argv[1];
634 Info = KdbpSymFindCachedFile(&ModName);
637 DPRINT1(
"Could not get aggregate\n");
644 PCHAR ArgStart = Argv[3];
645 DPRINT(
"Trying to get expression\n");
646 for (
i = 3;
i < Argc - 1;
i++)
653 DPRINT(
"Arg: %s\n", ArgStart);
722 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n"
723 " messages without Component ID and Level.\n"
724 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n"
725 " an unknown Component ID.\n\n");
726 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
727 KdbpPrint(
" Component Name Component ID\n"
728 " ================== ================\n");
736 for (
i = 1;
i < Argc;
i++)
747 if (
len != (
p - opt))
763 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
779 if (*
p ==
'+' || *
p ==
'-')
784 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
811 if (Argv[0][0] ==
'x')
820 if (
strcmp(Argv[Argc-2],
"L") == 0)
829 else if (Argv[Argc-1][0] ==
'L')
841 for (ul = 1; ul < Argc; ul++)
843 Argv[ul][
strlen(Argv[ul])] =
' ';
859 else if (Argv[0][0] ==
'x')
861 KdbpPrint(
"x: Address argument required.\n");
865 if (Argv[0][0] ==
'x')
927 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
928 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
929 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
930 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
931 " BIT23",
" BIT24",
" BIT25",
" BIT26",
932 " BIT27",
" BIT28",
" BIT29",
" BIT30",
935 if (Argv[0][0] ==
'r')
939 "SS:ESP 0x%04x:0x%08x\n"
940 " EAX 0x%08x EBX 0x%08x\n"
941 " ECX 0x%08x EDX 0x%08x\n"
942 " ESI 0x%08x EDI 0x%08x\n"
952 "SS:RSP 0x%04x:0x%p\n"
953 " RAX 0x%p RBX 0x%p\n"
954 " RCX 0x%p RDX 0x%p\n"
955 " RSI 0x%p RDI 0x%p\n"
966 for (
i = 0;
i < 32;
i++)
970 if ((
Context->EFlags & (1 << 1)) == 0)
980 else if ((
Context->EFlags & (1 <<
i)) != 0)
987 else if (Argv[0][0] ==
's')
989 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
992 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
994 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
996 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
998 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
1000 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
1005 ASSERT(Argv[0][0] ==
'd');
1037 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1082 (
PVOID)&Tss->Backlink,
1089 return (Backlink != 0 && Backlink != TssSelector);
1093KdbpContextFromPrevTss(
1116 Tss = KdbpRetrieveTss(Backlink,
NULL, pGdtr);
1135 *TssSelector = Backlink;
1159 if (FunctionEntry ==
NULL)
1211 GotNextFrame = GetNextFrame(&
Context);
1239 if (
strcmp(Argv[Argc-2],
"L") == 0)
1247 else if (Argv[Argc-1][0] ==
'L')
1258 for (ul = 1; ul < Argc; ul++)
1260 Argv[ul][
strlen(Argv[ul])] =
' ';
1268 if (Argv[1][0] ==
'*')
1283 KdbpPrint(
"Thread backtrace not supported yet!\n");
1297 TssSelector = Ke386GetTr();
1298 Tss = KdbpRetrieveTss(TssSelector,
NULL, &Gdtr);
1299 if (KdbpIsNestedTss(TssSelector, Tss))
1302 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1323 goto CheckForParentTSS;
1329 goto CheckForParentTSS;
1333 goto CheckForParentTSS;
1354 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1355 goto CheckForParentTSS;
1369 if (!KdbpIsNestedTss(TssSelector, Tss))
1372 GotNextFrame = KdbpContextFromPrevTss(&
Context, &TssSelector, &Tss, &Gdtr);
1383 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1422 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1427 if (Argv[0][0] ==
'n')
1454 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1486 GlobalOrLocal =
" global";
1497 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1501 ConditionExpr ?
" IF " :
"",
1502 ConditionExpr ? ConditionExpr :
"",
1511 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1513 ConditionExpr ?
" IF " :
"",
1514 ConditionExpr ? ConditionExpr :
"",
1521 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1524 ConditionExpr ?
" IF " :
"",
1525 ConditionExpr ? ConditionExpr :
"",
1547 KdbpPrint(
"%s: argument required\n", Argv[0]);
1552 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1553 if (pend == Argv[1] || *pend !=
'\0')
1555 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1559 if (Argv[0][1] ==
'e')
1563 else if (Argv [0][1] ==
'd')
1569 ASSERT(Argv[0][1] ==
'c');
1586 ULONG AddressArgIndex,
i;
1587 LONG ConditionArgIndex;
1590 if (Argv[0][2] ==
'x')
1594 KdbpPrint(
"bpx: Address argument required.\n");
1598 AddressArgIndex = 1;
1603 ASSERT(Argv[0][2] ==
'm');
1607 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1613 else if (
_stricmp(Argv[1],
"r") == 0)
1615 else if (
_stricmp(Argv[1],
"w") == 0)
1617 else if (
_stricmp(Argv[1],
"rw") == 0)
1621 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1631 AddressArgIndex = 3;
1632 if (
_stricmp(Argv[2],
"byte") == 0)
1634 else if (
_stricmp(Argv[2],
"word") == 0)
1636 else if (
_stricmp(Argv[2],
"dword") == 0)
1645 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1649 if (Argc <= AddressArgIndex)
1651 KdbpPrint(
"bpm: Address argument required.\n");
1659 ConditionArgIndex = -1;
1660 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1662 if (
strcmp(Argv[
i+1],
"IF") == 0)
1664 ConditionArgIndex =
i + 2;
1665 if ((
ULONG)ConditionArgIndex >= Argc)
1667 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1671 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1689 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1694 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1718 "Initialized",
"Ready",
"Running",
1719 "Standby",
"Terminated",
"Waiting",
1720 "Transition",
"DeferredReady"
1725 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1732 if (Argv[2] == pend)
1734 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1740 KdbpPrint(
"thread: Invalid process id!\n");
1745 ReferencedProcess =
TRUE;
1754 KdbpPrint(
"No threads in current process!\n");
1756 if (ReferencedProcess)
1762 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1805 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1820 if (ReferencedProcess)
1823 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1827 KdbpPrint(
"thread attach: thread id argument required!\n");
1832 if (Argv[2] == pend)
1834 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1843 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1852 if (Argv[1] == pend)
1854 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1860 KdbpPrint(
"thread: Invalid thread id!\n");
1865 ReferencedThread =
TRUE;
1875 " State: %s (0x%x)\n"
1877 " Affinity: 0x%08x\n"
1878 " Initial Stack: 0x%08x\n"
1879 " Stack Limit: 0x%08x\n"
1880 " Stack Base: 0x%08x\n"
1881 " Kernel Stack: 0x%08x\n"
1882 " Trap Frame: 0x%08x\n"
1884 " NPX State: %s (0x%x)\n"
1886 , (Argc < 2) ?
"Current Thread:\n" :
""
1902 if (ReferencedThread)
1923 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1928 KdbpPrint(
"No processes in the system!\n");
1962 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1966 KdbpPrint(
"process attach: process id argument required!\n");
1971 if (Argv[2] == pend)
1973 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
1992 if (Argv[1] == pend)
1994 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
2000 KdbpPrint(
"proc: Invalid process id!\n");
2005 ReferencedProcess =
TRUE;
2012 " State: %s (0x%x)\n"
2013 " Image Filename: %s\n",
2014 (Argc < 2) ?
"Current process:\n" :
"",
2020 if (ReferencedProcess)
2045 Argv[Argc][
strlen(Argv[Argc])] =
' ';
2054 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
2064 DisplayOnlyOneModule =
TRUE;
2072 KdbpPrint(
" %p %08x %s\n", (
PVOID)ntoskrnlBase, 0,
"ntoskrnl.exe");
2110 if (Argv[0][0] ==
'i')
2117 KdbpPrint(
"Interrupt descriptor table is empty.\n");
2122 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
2124 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2132 Dpl = ((SegDesc[1] >> 13) & 3);
2133 if ((SegDesc[1] & 0x1f00) == 0x0500)
2134 SegType =
"TASKGATE";
2135 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2136 SegType =
"INTGATE32";
2137 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2138 SegType =
"INTGATE16";
2139 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2140 SegType =
"TRAPGATE32";
2141 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2142 SegType =
"TRAPGATE16";
2144 SegType =
"UNKNOWN";
2146 if ((SegDesc[1] & (1 << 15)) == 0)
2148 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2149 i / 8, SegType, Dpl);
2151 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2153 SegSel = SegDesc[0] >> 16;
2155 i / 8, SegType, SegSel, Dpl);
2159 SegSel = SegDesc[0] >> 16;
2160 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2161 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2162 i / 8, SegType, SegSel, SegBase, Dpl);
2170 if (Argv[0][0] ==
'g')
2178 ASSERT(Argv[0][0] ==
'l');
2189 KdbpPrint(
"%s descriptor table is empty.\n",
2190 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2194 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2195 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2196 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2198 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2206 Dpl = ((SegDesc[1] >> 13) & 3);
2207 Type = ((SegDesc[1] >> 8) & 0xf);
2209 SegBase = SegDesc[0] >> 16;
2210 SegBase |= (SegDesc[1] & 0xff) << 16;
2211 SegBase |= SegDesc[1] & 0xff000000;
2212 SegLimit = SegDesc[0] & 0x0000ffff;
2213 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2215 if ((SegDesc[1] & (1 << 23)) != 0)
2225 if ((SegDesc[1] & (1 << 12)) == 0)
2229 case 1: SegType =
"TSS16(Avl)";
break;
2230 case 2: SegType =
"LDT";
break;
2231 case 3: SegType =
"TSS16(Busy)";
break;
2232 case 4: SegType =
"CALLGATE16";
break;
2233 case 5: SegType =
"TASKGATE";
break;
2234 case 6: SegType =
"INTGATE16";
break;
2235 case 7: SegType =
"TRAPGATE16";
break;
2236 case 9: SegType =
"TSS32(Avl)";
break;
2237 case 11: SegType =
"TSS32(Busy)";
break;
2238 case 12: SegType =
"CALLGATE32";
break;
2239 case 14: SegType =
"INTGATE32";
break;
2240 case 15: SegType =
"TRAPGATE32";
break;
2241 default: SegType =
"UNKNOWN";
break;
2251 else if ((SegDesc[1] & (1 << 11)) == 0)
2253 if ((SegDesc[1] & (1 << 22)) != 0)
2260 if ((SegDesc[1] & (1 << 22)) != 0)
2266 if ((SegDesc[1] & (1 << 15)) == 0)
2268 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2269 i / 8,
i | Dpl | ul, SegType, Dpl);
2273 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2274 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2276 if ((SegDesc[1] & (1 << 12)) == 0)
2280 else if ((SegDesc[1] & (1 << 11)) == 0)
2282 if ((SegDesc[1] & (1 << 10)) != 0)
2285 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2287 if ((SegDesc[1] & (1 << 8)) != 0)
2292 if ((SegDesc[1] & (1 << 10)) != 0)
2295 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2297 if ((SegDesc[1] & (1 << 8)) != 0)
2301 if ((SegDesc[1] & (1 << 20)) != 0)
2321 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2323 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n"
2324 " Tib.StackBase: 0x%08x\n"
2325 " Tib.StackLimit: 0x%08x\n"
2326 " Tib.SubSystemTib: 0x%08x\n"
2327 " Tib.FiberData/Version: 0x%08x\n"
2328 " Tib.ArbitraryUserPointer: 0x%08x\n"
2329 " Tib.Self: 0x%08x\n"
2330 " SelfPcr: 0x%08x\n"
2334 " IrrActive: 0x%08x\n"
2336 " KdVersionBlock: 0x%08x\n"
2340 " MajorVersion: 0x%04x\n"
2341 " MinorVersion: 0x%04x\n"
2342 " SetMember: 0x%08x\n"
2343 " StallScaleFactor: 0x%08x\n"
2345 " L2CacheAssociativity: 0x%02x\n"
2346 " VdmAlert: 0x%08x\n"
2347 " L2CacheSize: 0x%08x\n"
2348 " InterruptMode: 0x%08x\n"
2404 PCHAR Param, pszNext;
2408 if (Argv[1][0] ==
'*')
2411 ulValue =
strtoul(Param, &pszNext, 0);
2412 if (pszNext && *pszNext)
2414 KdbpPrint(
"Invalid TSS specification.\n");
2418 if (Argv[1][0] ==
'*')
2427 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2434 TssSelector = (
USHORT)ulValue;
2435 Tss = KdbpRetrieveTss(TssSelector,
NULL,
NULL);
2438 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2447 TssSelector = Ke386GetTr();
2452 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2453 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2455 " Ss0:Esp0: 0x%04x:0x%08x\n"
2476 " IoMapBase: 0x%04x\n",
2524 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2528 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2546 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2549 KdbpPrint(
"*** Dmesg: end of output ***\n");
2569 static const PCHAR ExceptionNames[21] =
2571 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2572 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2573 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2574 "MACHINECHECK",
"SIMDFAULT",
"OTHERS"
2581 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2582 KdbpPrint(
" break_on_module_load [true|false]\n");
2584 else if (
strcmp(Argv[1],
"syntax") == 0)
2592 if (
_stricmp(Argv[2],
"intel") == 0)
2594 else if (
_stricmp(Argv[2],
"at&t") == 0)
2597 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2600 else if (
strcmp(Argv[1],
"condition") == 0)
2604 KdbpPrint(
"Conditions: (First) (Last)\n");
2607 if (!ExceptionNames[
l])
2616 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2622 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2628 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2636 if (Argv[2] == pend)
2640 if (!ExceptionNames[
l])
2643 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2650 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2657 if (
_stricmp(Argv[3],
"first") == 0)
2659 else if (
_stricmp(Argv[3],
"last") == 0)
2663 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2667 if (
_stricmp(Argv[4],
"never") == 0)
2669 else if (
_stricmp(Argv[4],
"always") == 0)
2671 else if (
_stricmp(Argv[4],
"umode") == 0)
2673 else if (
_stricmp(Argv[4],
"kmode") == 0)
2677 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2684 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2686 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2699 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2700 l, ExceptionNames[
l],
2706 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2713 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2721 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2724 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2729 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2744 KdbpPrint(
"Kernel debugger commands:\n");
2773 const unsigned char *
cp;
2777 cp = (
unsigned char *)
s +
n;
2780 if (*(--
cp) == (
unsigned char)
c)
2815 ULONG p0len = TermSize->cx * TermSize->cy;
2816 PCCH p0 = pCurPos - p0len;
2817 PCCH prev_p = p0, p1;
2827 for (
j = TermSize->cy;
j--; )
2840 linesCnt = (TermSize->cx+prev_p-
p-2) / TermSize->cx;
2897 LONG RowsPrintedByTerminal;
2907 if (!TerminalInitialized)
2909 TerminalInitialized =
TRUE;
2921 while (
p[0] !=
'\0')
2927 KdbPrintf(
"Dmesg: error, p > Buffer+BufLength,d=%d",
p - (
Buffer + BufLength));
2945 RowsPrintedByTerminal = 0;
2948 RowsPrintedByTerminal++;
2965 Prompt =
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---";
2967 Prompt =
"--- Press q to abort, any other key to continue ---";
2976 RowsPrintedByTerminal++;
3010 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3212 static PCHAR Argv[256];
3213 static CHAR OrigCommand[1024];
3222 while (*
p ==
'\t' || *
p ==
' ')
3258 KdbpPrint(
"Command '%s' is unknown.\n", OrigCommand);
3273 static CHAR LastCommand[1024] =
"";
3275 if (EnteredOnSingleStep)
3308 else if (CmdLen > 1)
3348 DPRINT(
"KDB: Executing KDBinit file...\n");
3350 while (p1[0] !=
'\0')
3364 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3365 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3370 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3379 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3382 DPRINT(
"KDB: KDBinit executed\n");
3423 DPRINT1(
"Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%lx)\n",
Status);
3429 &FileStdInfo,
sizeof(FileStdInfo),
3434 DPRINT1(
"Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%lx)\n",
Status);
3455 DPRINT1(
"Could not read KDBinit file into memory (Status 0x%lx)\n",
Status);
3573 else if (BootPhase == 1)
3605 " KDBG debugger enabled - %s\r\n",
3608 :
"Loading symbols");
int strcmp(const char *String1, const char *String2)
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
ACPI_SIZE strlen(const char *String)
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
#define COVERAGE(name, NAME, description, tag1, tag2, tag3, tag4)
#define DPFLTR_ERROR_LEVEL
#define FILE_NON_DIRECTORY_FILE
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
#define NT_SUCCESS(StatCode)
#define INVALID_HANDLE_VALUE
#define _strnicmp(_String1, _String2, _MaxCount)
#define InsertTailList(ListHead, Entry)
#define KeInitializeSpinLock(sl)
#define ExAllocatePool(type, size)
struct _FileName FileName
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
#define FILE_SYNCHRONOUS_IO_NONALERT
#define FILE_NO_INTERMEDIATE_BUFFERING
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
_Must_inspect_result_ _Out_ PLARGE_INTEGER FileSize
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
#define UNW_FLAG_NHANDLER
VOID NTAPI HalReturnToFirmware(_In_ FIRMWARE_REENTRY Action)
LONG KdbpDisassemble(IN ULONG_PTR Address, IN ULONG IntelSyntax)
NTHALAPI VOID NTAPI HalDisplayString(PUCHAR String)
#define OBJ_KERNEL_HANDLE
#define OBJ_CASE_INSENSITIVE
void __cdecl _disable(void)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
__INTRIN_INLINE uintptr_t __readeflags(void)
__INTRIN_INLINE void __sidt(void *Destination)
VOID NTAPI KdbpReleaseLock(_In_ PKSPIN_LOCK SpinLock, _In_ KIRQL OldIrql)
KIRQL NTAPI KdbpAcquireLock(_In_ PKSPIN_LOCK SpinLock)
NTSTATUS NTAPI NtSetDebugFilterState(_In_ ULONG ComponentId, _In_ ULONG Level, _In_ BOOLEAN State)
PEPROCESS KdbCurrentProcess
LONG KdbpGetNextBreakPointNr(IN ULONG Start OPTIONAL)
Gets the number of the next breakpoint >= Start.
PETHREAD KdbCurrentThread
PKDB_KTRAP_FRAME KdbCurrentTrapFrame
BOOLEAN KdbpSetEnterCondition(IN LONG ExceptionNr, IN BOOLEAN FirstChance, IN KDB_ENTER_CONDITION Condition)
Sets the first or last chance enter-condition for exception nr. ExceptionNr.
BOOLEAN KdbpDisableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Disables a breakpoint.
BOOLEAN KdbpGetEnterCondition(IN LONG ExceptionNr, IN BOOLEAN FirstChance, OUT KDB_ENTER_CONDITION *Condition)
Gets the first or last chance enter-condition for exception nr. ExceptionNr.
BOOLEAN KdbpAttachToProcess(PVOID ProcessId)
Switches to another process/thread context.
BOOLEAN KdbpAttachToThread(PVOID ThreadId)
Switches to another thread context.
BOOLEAN KdbpEnableBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Enables a breakpoint.
BOOLEAN KdbSingleStepOver
BOOLEAN KdbpDeleteBreakPoint(IN LONG BreakPointNr OPTIONAL, IN OUT PKDB_BREAKPOINT BreakPoint OPTIONAL)
Deletes a breakpoint.
NTSTATUS KdbpInsertBreakPoint(IN ULONG_PTR Address, IN KDB_BREAKPOINT_TYPE Type, IN UCHAR Size OPTIONAL, IN KDB_ACCESS_TYPE AccessType OPTIONAL, IN PCHAR ConditionExpression OPTIONAL, IN BOOLEAN Global, OUT PLONG BreakPointNr OPTIONAL)
Inserts a breakpoint into the breakpoint array.
NTSTATUS KdbpSafeReadMemory(OUT PVOID Dest, IN PVOID Src, IN ULONG Bytes)
VOID KdbpGetCommandLineSettings(_In_ PCSTR p1)
BOOLEAN KdbpGetBreakPointInfo(IN ULONG BreakPointNr, OUT ULONG_PTR *Address OPTIONAL, OUT KDB_BREAKPOINT_TYPE *Type OPTIONAL, OUT UCHAR *Size OPTIONAL, OUT KDB_ACCESS_TYPE *AccessType OPTIONAL, OUT UCHAR *DebugReg OPTIONAL, OUT BOOLEAN *Enabled OPTIONAL, OUT BOOLEAN *Global OPTIONAL, OUT PEPROCESS *Process OPTIONAL, OUT PCHAR *ConditionExpression OPTIONAL)
Returns information of the specified breakpoint.
BOOLEAN KdbSymPrintAddress(IN PVOID Address, IN PCONTEXT Context)
Print address...
enum _KDB_ENTER_CONDITION KDB_ENTER_CONDITION
BOOLEAN KdbpRpnEvaluateExpression(IN PCHAR Expression, IN PKDB_KTRAP_FRAME TrapFrame, OUT PULONGLONG Result, OUT PLONG ErrOffset OPTIONAL, OUT PCHAR ErrMsg OPTIONAL)
Evaluates the given expression.
VOID KdbpCommandHistoryAppend(_In_ PCSTR Command)
Appends a command to the command history.
VOID KdbPuts(_In_ PCSTR String)
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
BOOLEAN KdbSymInit(_In_ ULONG BootPhase)
Initializes the KDB symbols implementation.
VOID __cdecl KdbPrintf(_In_ PCSTR Format,...)
SIZE_T KdbPrompt(_In_ PCSTR Prompt, _Out_ PCHAR Buffer, _In_ SIZE_T Size)
enum _KDB_ACCESS_TYPE KDB_ACCESS_TYPE
enum _KDB_BREAKPOINT_TYPE KDB_BREAKPOINT_TYPE
VOID KdbpPager(_In_ PCHAR Buffer, _In_ ULONG BufLength)
Prints the given string with, page by page.
static BOOLEAN KdbRepeatLastCommand
static BOOLEAN KdbpCmdBreakPointList(ULONG Argc, PCHAR Argv[])
Lists breakpoints.
#define KDB_ACCESS_TYPE_TO_STRING(type)
static ULONG KdbNumberOfRowsPrinted
static BOOLEAN KdbpCmdEnableDisableClearBreakPoint(ULONG Argc, PCHAR Argv[])
Enables, disables or clears a breakpoint.
static const struct @1820 KdbDebuggerCommands[]
#define KDB_ENTER_CONDITION_TO_STRING(cond)
static BOOLEAN KdbpCmdRegs(ULONG Argc, PCHAR Argv[])
Displays CPU registers.
void * memrchr(const void *s, int c, size_t n)
static BOOLEAN KdbUseIntelSyntax
static PKDBG_CLI_ROUTINE KdbCliCallbacks[10]
static KSPIN_LOCK KdpDmesgLogSpinLock
static BOOLEAN KdbpCmdContinue(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
VOID KdbpCliInterpretInitFile(VOID)
This function is called by KdbEnterDebuggerException...
static BOOLEAN KdbBreakOnModuleLoad
static VOID KdpFilterEscapes(_Inout_ PSTR String)
BOOLEAN NTAPI KdbRegisterCliCallback(PVOID Callback, BOOLEAN Deregister)
static VOID KdbpPagerInternal(_In_ PCHAR Buffer, _In_ ULONG BufLength, _In_ BOOLEAN DoPage)
Prints the given string with, page by page.
BOOLEAN ExpKdbgExtPool(ULONG Argc, PCHAR Argv[])
static VOID NTAPI KdbDebugPrint(_In_ PCCH String, _In_ ULONG Length)
Debug logger function.
static BOOLEAN KdbpEvaluateExpression(IN PCHAR Expression, IN LONG ErrOffset, OUT PULONGLONG Result)
Evaluates an expression...
static const ULONG KdpDmesgBufferSize
#define NPX_STATE_TO_STRING(state)
BOOLEAN ExpKdbgExtPoolFind(ULONG Argc, PCHAR Argv[])
BOOLEAN KdbpBugCheckRequested
static BOOLEAN KdbpCmdProc(ULONG Argc, PCHAR Argv[])
Lists processes or switches to another process context.
#define Ke386GetGlobalDescriptorTable
static volatile ULONG KdpDmesgCurrentPosition
static BOOLEAN KdbpCmdStep(ULONG Argc, PCHAR Argv[])
Continues execution of the system/leaves KDB.
static BOOLEAN KdbpCmdBackTrace(ULONG Argc, PCHAR Argv[])
Displays a backtrace.
static volatile ULONG KdpDmesgFreeBytes
NTSTATUS NTAPI KdbInitialize(_In_ PKD_DISPATCH_TABLE DispatchTable, _In_ ULONG BootPhase)
Initializes the KDBG debugger.
VOID KdbpPrintUnicodeString(_In_ PCUNICODE_STRING String)
static BOOLEAN KdbpCmdBreakPoint(ULONG Argc, PCHAR Argv[])
Sets a software or hardware (memory) breakpoint at the given address.
static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[])
Display debug messages on screen, with paging.
BOOLEAN ExpKdbgExtIrpFind(ULONG Argc, PCHAR Argv[])
static struct @1819 ComponentTable[]
#define Ke386GetLocalDescriptorTable
BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[])
static BOOLEAN KdbpDoCommand(IN PCHAR Command)
Parses command line and executes command if found.
static BOOLEAN KdbpGetComponentId(IN PCSTR ComponentName, OUT PULONG ComponentId)
Retrieves the component ID corresponding to a given component name.
BOOLEAN(* Fn)(ULONG Argc, PCHAR Argv[])
static BOOLEAN KdbpCmdDisassembleX(ULONG Argc, PCHAR Argv[])
Disassembles 10 instructions at eip or given address or displays 16 dwords from memory at given addre...
static BOOLEAN KdbpCmdPcr(ULONG Argc, PCHAR Argv[])
Displays the KPCR.
static PCHAR KdpDmesgBuffer
static BOOLEAN KdbpCmdFilter(ULONG Argc, PCHAR Argv[])
Displays the list of active debug channels, or enable/disable debug channels.
static BOOLEAN KdbOutputAborted
VOID KdbpPrint(_In_ PSTR Format, _In_ ...)
Prints the given string with printf-like formatting.
static volatile ULONG KdbDmesgTotalWritten
BOOLEAN ExpKdbgExtPoolUsed(ULONG Argc, PCHAR Argv[])
BOOLEAN(NTAPI * PKDBG_CLI_ROUTINE)(IN PCHAR Command, IN ULONG Argc, IN PCH Argv[])
static BOOLEAN KdbpCmdHelp(ULONG Argc, PCHAR Argv[])
Displays help screen.
static BOOLEAN KdbpCmdEvalExpression(ULONG Argc, PCHAR Argv[])
Evaluates an expression and displays the result.
BOOLEAN ExpKdbgExtDefWrites(ULONG Argc, PCHAR Argv[])
static volatile BOOLEAN KdbpIsInDmesgMode
static BOOLEAN KdbpCmdMod(ULONG Argc, PCHAR Argv[])
Lists loaded modules or the one containing the specified address.
const CSTRING KdbPromptStr
static PCHAR CountOnePageUp(_In_ PCCH Buffer, _In_ ULONG BufLength, _In_ PCCH pCurPos, _In_ const SIZE *TermSize)
Calculate pointer position for N lines above the current position.
BOOLEAN ExpKdbgExtFileCache(ULONG Argc, PCHAR Argv[])
static BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[])
Bugchecks the system.
static BOOLEAN KdbpCmdSet(ULONG Argc, PCHAR Argv[])
Sets or displays a config variables value.
static BOOLEAN KdbpInvokeCliCallbacks(IN PCHAR Command, IN ULONG Argc, IN PCHAR Argv[])
Invokes registered CLI callbacks until one of them handled the Command.
static ULONG KdbNumberOfColsPrinted
#define KD_DEBUG_PRINT_FILTER(Name)
static BOOLEAN KdbpCmdGdtLdtIdt(ULONG Argc, PCHAR Argv[])
Displays GDT, LDT or IDT.
static BOOLEAN KdbpCmdThread(ULONG Argc, PCHAR Argv[])
Lists threads or switches to another thread context.
VOID KdbpCliMainLoop(IN BOOLEAN EnteredOnSingleStep)
KDB Main Loop.
BOOLEAN NTAPI KdbpGetHexNumber(IN PCHAR pszNum, OUT ULONG_PTR *pulValue)
NTSTATUS KdbpCliInit(VOID)
Called when KDB is initialized.
static BOOLEAN KdbpCmdReboot(ULONG Argc, PCHAR Argv[])
static BOOLEAN LoadSymbols
BOOLEAN KdpUpdateTerminalSize(_Out_ PSIZE TermSize)
BOOLEAN KdpInitTerminal(VOID)
Initializes the controlling terminal.
CHAR KdpReadTermKey(_Out_ PULONG ScanCode)
Reads one character from the terminal. This function returns a scan code even when reading is done fr...
PLOADER_PARAMETER_BLOCK KeLoaderBlock
#define memmove(s1, s2, n)
static const struct op_mask SETUP
#define sprintf(buf, format,...)
FORCEINLINE PVOID ExAllocatePoolZero(ULONG PoolType, SIZE_T NumberOfBytes, ULONG Tag)
#define InitializeObjectAttributes(p, n, a, r, s)
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
#define DPFLTR_WARNING_LEVEL
#define DPFLTR_INFO_LEVEL
#define DPFLTR_TRACE_LEVEL
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
NTSYSAPI NTSTATUS NTAPI ZwClose(_In_ HANDLE Handle)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI VOID NTAPI RtlFreeUnicodeString(PUNICODE_STRING UnicodeString)
_IRQL_requires_same_ _In_ PVOID EstablisherFrame
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
_In_ ULONG _In_ ULONG _In_ ULONG Length
FORCEINLINE ULONG_PTR KeGetTrapFrameFrameRegister(PKTRAP_FRAME TrapFrame)
FORCEINLINE ULONG_PTR KeGetContextFrameRegister(PCONTEXT Context)
FORCEINLINE VOID KeSetContextFrameRegister(PCONTEXT Context, ULONG_PTR Frame)
FORCEINLINE ULONG_PTR KeGetTrapFrameStackRegister(PKTRAP_FRAME TrapFrame)
#define KeGetContextPc(Context)
#define KeGetTrapFramePc(TrapFrame)
NTSTATUS NTAPI PsLookupProcessByProcessId(IN HANDLE ProcessId, OUT PEPROCESS *Process)
NTSTATUS NTAPI PsLookupThreadByThreadId(IN HANDLE ThreadId, OUT PETHREAD *Thread)
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
NTSTRSAFEAPI RtlStringCbCopyA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ NTSTRSAFE_PCSTR pszSrc)
#define FileStandardInformation
LIST_ENTRY PsActiveProcessHead
#define _SEH2_EXCEPT(...)
VOID RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate)
BOOLEAN RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate)
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
static const char *const debug_classes[]
#define STATUS_END_OF_FILE
static int ErrMsg(int Error)
PULONG MinorVersion OPTIONAL
base of all file and directory entries
struct _KGDTENTRY::@2451::@2453 Bits
struct _KGDTENTRY::@2451::@2452 Bytes
union _KGDTENTRY::@2451 HighWord
ULONG SecondLevelCacheSize
UCHAR SecondLevelCacheAssociativity
struct _KPRCB * CurrentPrcb
union _KGDTENTRY64 * GdtBase
PKSPIN_LOCK_QUEUE LockArray
union _KIDTENTRY64 * IdtBase
volatile VOID * StackLimit
UNICODE_STRING BaseDllName
struct _LIST_ENTRY * Flink
PVOID ArbitraryUserPointer
struct _EXCEPTION_REGISTRATION_RECORD * ExceptionList
PROSSYM_AGGREGATE_MEMBER Elements
#define RTL_CONSTANT_STRING(s)
#define RtlCopyMemory(Destination, Source, Length)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_OBJECT_PATH_NOT_FOUND
#define STATUS_OBJECT_NAME_NOT_FOUND
struct _LARGE_INTEGER::@2299 u
PEXCEPTION_ROUTINE NTAPI RtlVirtualUnwind(_In_ ULONG HandlerType, _In_ ULONG64 ImageBase, _In_ ULONG64 ControlPc, _In_ PRUNTIME_FUNCTION FunctionEntry, _Inout_ PCONTEXT Context, _Outptr_ PVOID *HandlerData, _Out_ PULONG64 EstablisherFrame, _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers)
PRUNTIME_FUNCTION NTAPI RtlLookupFunctionEntry(IN DWORD64 ControlPc, OUT PDWORD64 ImageBase, OUT PUNWIND_HISTORY_TABLE HistoryTable)
Locates the RUNTIME_FUNCTION entry corresponding to a code address. http://msdn.microsoft....
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_In_ PWDFDEVICE_INIT _In_ PWDF_PDO_EVENT_CALLBACKS DispatchTable
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
void int int ULONGLONG int va_list * ap
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define ObDereferenceObject