33#include "../kd/kdterminal.h"
40#define KDB_ENTER_CONDITION_TO_STRING(cond) \
41 ((cond) == KdbDoNotEnter ? "never" : \
42 ((cond) == KdbEnterAlways ? "always" : \
43 ((cond) == KdbEnterFromKmode ? "kmode" : "umode")))
45#define KDB_ACCESS_TYPE_TO_STRING(type) \
46 ((type) == KdbAccessRead ? "read" : \
47 ((type) == KdbAccessWrite ? "write" : \
48 ((type) == KdbAccessReadWrite ? "rdwr" : "exec")))
50#define NPX_STATE_TO_STRING(state) \
51 ((state) == NPX_STATE_LOADED ? "Loaded" : \
52 ((state) == NPX_STATE_NOT_LOADED ? "Not loaded" : "Unknown"))
99#ifndef Ke386GetGlobalDescriptorTable
100# define Ke386GetGlobalDescriptorTable __sgdt
102#ifndef Ke386GetLocalDescriptorTable
103# define Ke386GetLocalDescriptorTable __sldt
153#define KD_DEBUG_PRINT_FILTER(Name) \
154 { #Name, DPFLTR_##Name##_ID }
335#undef KD_DEBUG_PRINT_FILTER
351 {
"disasm",
"disasm [address] [L count]",
"Disassemble count instructions at address.",
KdbpCmdDisassembleX },
353 {
"x",
"x [address] [L count]",
"Display count dwords, starting at address.",
KdbpCmdDisassembleX },
354 {
"regs",
"regs",
"Display general purpose registers.",
KdbpCmdRegs },
355 {
"sregs",
"sregs",
"Display status registers.",
KdbpCmdRegs },
356 {
"dregs",
"dregs",
"Display debug registers.",
KdbpCmdRegs },
357 {
"bt",
"bt [*frameaddr|thread id]",
"Prints current backtrace or from given frame address.",
KdbpCmdBackTrace },
359 {
"dt",
"dt [mod] [type] [addr]",
"Print a struct. The address is optional.", KdbpCmdPrintStruct },
363 {
"cont",
"cont",
"Continue execution (leave debugger).",
KdbpCmdContinue },
364 {
"step",
"step [count]",
"Execute single instructions, stepping into interrupts.",
KdbpCmdStep },
365 {
"next",
"next [count]",
"Execute single instructions, skipping calls and reps.",
KdbpCmdStep },
370 {
"bpx",
"bpx [address] [IF condition]",
"Set software execution breakpoint at address.",
KdbpCmdBreakPoint },
371 {
"bpm",
"bpm [r|w|rw|x] [byte|word|dword] [address] [IF condition]",
"Set memory breakpoint at address.",
KdbpCmdBreakPoint },
375 {
"thread",
"thread [list[ pid]|[attach ]tid]",
"List threads in current or specified process, display thread with given id or attach to thread.",
KdbpCmdThread },
376 {
"proc",
"proc [list|[attach ]pid]",
"List processes, display process with given id or attach to process.",
KdbpCmdProc },
380 {
"mod",
"mod [address]",
"List all modules or the one containing address.",
KdbpCmdMod },
383 {
"idt",
"idt",
"Display the interrupt descriptor table.",
KdbpCmdGdtLdtIdt },
384 {
"pcr",
"pcr",
"Display the processor control region.",
KdbpCmdPcr },
386 {
"tss",
"tss [selector|*descaddr]",
"Display the current task state segment, or the one specified by its selector number or descriptor address.", KdbpCmdTss },
393 {
"filter",
"filter [error|warning|trace|info|level]+|-[componentname|default]",
"Enable/disable debug channels.",
KdbpCmdFilter },
394 {
"set",
"set [var] [value]",
"Sets var to value or displays value of var.",
KdbpCmdSet },
395 {
"dmesg",
"dmesg",
"Display debug messages on screen, with navigation on pages.",
KdbpCmdDmesg },
396 {
"kmsg",
"kmsg",
"Kernel dmesg. Alias for dmesg.",
KdbpCmdDmesg },
397 {
"help",
"help",
"Display help screen.",
KdbpCmdHelp },
398 {
"!pool",
"!pool [Address [Flags]]",
"Display information about pool allocations.",
ExpKdbgExtPool },
399 {
"!poolused",
"!poolused [Flags [Tag]]",
"Display pool usage.",
ExpKdbgExtPoolUsed },
400 {
"!poolfind",
"!poolfind Tag [Pool]",
"Search for pool tag allocations.",
ExpKdbgExtPoolFind },
403 {
"!irpfind",
"!irpfind [Pool [startaddress [criteria data]]]",
"Lists IRPs potentially matching criteria.",
ExpKdbgExtIrpFind },
404 {
"!handle",
"!handle [Handle]",
"Displays info about handles.",
ExpKdbgExtHandle },
427 static CHAR ErrMsgBuffer[130] =
"^ ";
428 LONG ExpressionErrOffset = -1;
429 PCHAR ErrMsg = ErrMsgBuffer;
433 &ExpressionErrOffset, ErrMsgBuffer + 2);
436 if (ExpressionErrOffset >= 0)
437 ExpressionErrOffset += ErrOffset;
441 KdbpPrint(
"%*s%s\n", ExpressionErrOffset,
"", ErrMsg);
456 if ((pszNum[0] ==
'0') && ((pszNum[1] ==
'x') || (pszNum[1] ==
'X')))
460 *pulValue =
strtoul(pszNum, &endptr, 16);
462 return (*endptr ==
'\0');
487 for (
i = 1;
i < Argc;
i++)
497 if (
Result > 0x00000000ffffffffLL)
499 if (
Result & 0x8000000000000000LL)
508 if (ul <= 0xff && ul >= 0x80)
510 else if (ul <= 0xffff && ul >= 0x8000)
516 KdbpPrint(
"0x%08lx %10lu %10ld\n", ul, ul,
l);
530KdbpPrintStructInternal
547 if (!
strcmp(Member->
Type,
"_UNICODE_STRING")) {
552 }
else if (!
strcmp(Member->
Type,
"PUNICODE_STRING")) {
558 switch (Member->
Size) {
575 if (Member->
Size < 8) {
578 for (
j = 0;
j < Member->
Size;
j++) {
582 }
else goto readfail;
585 Indent[IndentLen] =
' ';
590 Indent[IndentLen] = 0;
597 if (Member->
Size <= 8) {
601 Indent[IndentLen] =
' ';
603 KdbpPrintStructInternal(
Info, Indent, DoRead,
BaseAddress, &MemberAggregate);
606 Indent[IndentLen] = 0;
626 CHAR Indent[100] = {0};
629 if (Argc < 3)
goto end;
631 AnsiName.
Buffer = Argv[1];
633 Info = KdbpSymFindCachedFile(&ModName);
636 DPRINT1(
"Could not get aggregate\n");
643 PCHAR ArgStart = Argv[3];
644 DPRINT1(
"Trying to get expression\n");
645 for (
i = 3;
i < Argc - 1;
i++)
652 DPRINT1(
"Arg: %s\n", ArgStart);
723 "- The 'WIN2000' system-wide debug filter component is used for DbgPrint()\n"
724 " messages without Component ID and Level.\n"
725 "- The 'DEFAULT' debug filter component is used for DbgPrint() messages with\n"
726 " an unknown Component ID.\n\n");
727 KdbpPrint(
"The list of debug filter components currently available on your system is:\n\n");
728 KdbpPrint(
" Component Name Component ID\n"
729 " ================== ================\n");
737 for (
i = 1;
i < Argc;
i++)
748 if (
len != (
p - opt))
764 KdbpPrint(
"filter: bad class name '%.*s'\n",
p - opt, opt);
780 if (*
p ==
'+' || *
p ==
'-')
785 KdbpPrint(
"filter: '%s' is not a valid component name!\n",
p);
812 if (Argv[0][0] ==
'x')
821 if (
strcmp(Argv[Argc-2],
"L") == 0)
830 else if (Argv[Argc-1][0] ==
'L')
842 for (ul = 1; ul < Argc; ul++)
844 Argv[ul][
strlen(Argv[ul])] =
' ';
860 else if (Argv[0][0] ==
'x')
862 KdbpPrint(
"x: Address argument required.\n");
866 if (Argv[0][0] ==
'x')
928 static const PCHAR EflagsBits[32] = {
" CF",
NULL,
" PF",
" BIT3",
" AF",
" BIT5",
929 " ZF",
" SF",
" TF",
" IF",
" DF",
" OF",
930 NULL,
NULL,
" NT",
" BIT15",
" RF",
" VF",
931 " AC",
" VIF",
" VIP",
" ID",
" BIT22",
932 " BIT23",
" BIT24",
" BIT25",
" BIT26",
933 " BIT27",
" BIT28",
" BIT29",
" BIT30",
936 if (Argv[0][0] ==
'r')
940 "SS:ESP 0x%04x:0x%08x\n"
941 " EAX 0x%08x EBX 0x%08x\n"
942 " ECX 0x%08x EDX 0x%08x\n"
943 " ESI 0x%08x EDI 0x%08x\n"
953 "SS:RSP 0x%04x:0x%p\n"
954 " RAX 0x%p RBX 0x%p\n"
955 " RCX 0x%p RDX 0x%p\n"
956 " RSI 0x%p RDI 0x%p\n"
967 for (
i = 0;
i < 32;
i++)
971 if ((
Context->EFlags & (1 << 1)) == 0)
981 else if ((
Context->EFlags & (1 <<
i)) != 0)
988 else if (Argv[0][0] ==
's')
990 KdbpPrint(
"CS 0x%04x Index 0x%04x %cDT RPL%d\n",
993 KdbpPrint(
"DS 0x%04x Index 0x%04x %cDT RPL%d\n",
995 KdbpPrint(
"ES 0x%04x Index 0x%04x %cDT RPL%d\n",
997 KdbpPrint(
"FS 0x%04x Index 0x%04x %cDT RPL%d\n",
999 KdbpPrint(
"GS 0x%04x Index 0x%04x %cDT RPL%d\n",
1001 KdbpPrint(
"SS 0x%04x Index 0x%04x %cDT RPL%d\n",
1006 ASSERT(Argv[0][0] ==
'd');
1038 if ((TssSelector & (
sizeof(
KGDTENTRY) - 1)) ||
1083 (
PVOID)&Tss->Backlink,
1090 return (Backlink != 0 && Backlink != TssSelector);
1094KdbpContextFromPrevTss(
1117 Tss = KdbpRetrieveTss(Backlink,
NULL, pGdtr);
1136 *TssSelector = Backlink;
1160 if (FunctionEntry ==
NULL)
1212 GotNextFrame = GetNextFrame(&
Context);
1240 if (
strcmp(Argv[Argc-2],
"L") == 0)
1248 else if (Argv[Argc-1][0] ==
'L')
1259 for (ul = 1; ul < Argc; ul++)
1261 Argv[ul][
strlen(Argv[ul])] =
' ';
1269 if (Argv[1][0] ==
'*')
1284 KdbpPrint(
"Thread backtrace not supported yet!\n");
1298 TssSelector = Ke386GetTr();
1299 Tss = KdbpRetrieveTss(TssSelector,
NULL, &Gdtr);
1300 if (KdbpIsNestedTss(TssSelector, Tss))
1303 KdbpPrint(
"[Active TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1324 goto CheckForParentTSS;
1330 goto CheckForParentTSS;
1334 goto CheckForParentTSS;
1355 KdbpPrint(
"Couldn't access memory at 0x%p!\n", Frame);
1356 goto CheckForParentTSS;
1370 if (!KdbpIsNestedTss(TssSelector, Tss))
1373 GotNextFrame = KdbpContextFromPrevTss(&
Context, &TssSelector, &Tss, &Gdtr);
1384 KdbpPrint(
"[Parent TSS 0x%04x @ 0x%p]\n", TssSelector, Tss);
1423 KdbpPrint(
"%s: Integer argument required\n", Argv[0]);
1428 if (Argv[0][0] ==
'n')
1455 PCHAR str1, str2, ConditionExpr, GlobalOrLocal;
1487 GlobalOrLocal =
" global";
1498 KdbpPrint(
" %s%03d BPX 0x%08x%s%s%s%s%s\n",
1502 ConditionExpr ?
" IF " :
"",
1503 ConditionExpr ? ConditionExpr :
"",
1512 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1514 ConditionExpr ?
" IF " :
"",
1515 ConditionExpr ? ConditionExpr :
"",
1522 Size == 1 ?
"byte" : (
Size == 2 ?
"word" :
"dword"),
1525 ConditionExpr ?
" IF " :
"",
1526 ConditionExpr ? ConditionExpr :
"",
1548 KdbpPrint(
"%s: argument required\n", Argv[0]);
1553 BreakPointNr =
strtoul(Argv[1], &pend, 0);
1554 if (pend == Argv[1] || *pend !=
'\0')
1556 KdbpPrint(
"%s: integer argument required\n", Argv[0]);
1560 if (Argv[0][1] ==
'e')
1564 else if (Argv [0][1] ==
'd')
1570 ASSERT(Argv[0][1] ==
'c');
1587 ULONG AddressArgIndex,
i;
1588 LONG ConditionArgIndex;
1591 if (Argv[0][2] ==
'x')
1595 KdbpPrint(
"bpx: Address argument required.\n");
1599 AddressArgIndex = 1;
1604 ASSERT(Argv[0][2] ==
'm');
1608 KdbpPrint(
"bpm: Access type argument required (one of r, w, rw, x)\n");
1614 else if (
_stricmp(Argv[1],
"r") == 0)
1616 else if (
_stricmp(Argv[1],
"w") == 0)
1618 else if (
_stricmp(Argv[1],
"rw") == 0)
1622 KdbpPrint(
"bpm: Unknown access type '%s'\n", Argv[1]);
1632 AddressArgIndex = 3;
1633 if (
_stricmp(Argv[2],
"byte") == 0)
1635 else if (
_stricmp(Argv[2],
"word") == 0)
1637 else if (
_stricmp(Argv[2],
"dword") == 0)
1646 KdbpPrint(
"bpm: Unknown memory size '%s'\n", Argv[2]);
1650 if (Argc <= AddressArgIndex)
1652 KdbpPrint(
"bpm: Address argument required.\n");
1660 ConditionArgIndex = -1;
1661 for (
i = AddressArgIndex;
i < (Argc-1);
i++)
1663 if (
strcmp(Argv[
i+1],
"IF") == 0)
1665 ConditionArgIndex =
i + 2;
1666 if ((
ULONG)ConditionArgIndex >= Argc)
1668 KdbpPrint(
"%s: IF requires condition expression.\n", Argv[0]);
1672 for (
i = ConditionArgIndex;
i < (Argc-1);
i++)
1690 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
1695 (ConditionArgIndex < 0) ?
NULL : Argv[ConditionArgIndex],
1719 "Initialized",
"Ready",
"Running",
1720 "Standby",
"Terminated",
"Waiting",
1721 "Transition",
"DeferredReady"
1726 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1733 if (Argv[2] == pend)
1735 KdbpPrint(
"thread: '%s' is not a valid process id!\n", Argv[2]);
1741 KdbpPrint(
"thread: Invalid process id!\n");
1746 ReferencedProcess =
TRUE;
1755 KdbpPrint(
"No threads in current process!\n");
1757 if (ReferencedProcess)
1763 KdbpPrint(
" TID State Prior. Affinity EBP EIP\n");
1806 KdbpPrint(
" %s0x%08x %-11s %3d 0x%08x 0x%08x 0x%08x%s\n",
1821 if (ReferencedProcess)
1824 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1828 KdbpPrint(
"thread attach: thread id argument required!\n");
1833 if (Argv[2] == pend)
1835 KdbpPrint(
"thread attach: '%s' is not a valid thread id!\n", Argv[2]);
1844 KdbpPrint(
"Attached to thread 0x%08x.\n", ul);
1853 if (Argv[1] == pend)
1855 KdbpPrint(
"thread: '%s' is not a valid thread id!\n", Argv[1]);
1861 KdbpPrint(
"thread: Invalid thread id!\n");
1866 ReferencedThread =
TRUE;
1876 " State: %s (0x%x)\n"
1878 " Affinity: 0x%08x\n"
1879 " Initial Stack: 0x%08x\n"
1880 " Stack Limit: 0x%08x\n"
1881 " Stack Base: 0x%08x\n"
1882 " Kernel Stack: 0x%08x\n"
1883 " Trap Frame: 0x%08x\n"
1885 " NPX State: %s (0x%x)\n"
1887 , (Argc < 2) ?
"Current Thread:\n" :
""
1903 if (ReferencedThread)
1924 if (Argc >= 2 &&
_stricmp(Argv[1],
"list") == 0)
1929 KdbpPrint(
"No processes in the system!\n");
1963 else if (Argc >= 2 &&
_stricmp(Argv[1],
"attach") == 0)
1967 KdbpPrint(
"process attach: process id argument required!\n");
1972 if (Argv[2] == pend)
1974 KdbpPrint(
"process attach: '%s' is not a valid process id!\n", Argv[2]);
1993 if (Argv[1] == pend)
1995 KdbpPrint(
"proc: '%s' is not a valid process id!\n", Argv[1]);
2001 KdbpPrint(
"proc: Invalid process id!\n");
2006 ReferencedProcess =
TRUE;
2013 " State: %s (0x%x)\n"
2014 " Image Filename: %s\n",
2015 (Argc < 2) ?
"Current process:\n" :
"",
2021 if (ReferencedProcess)
2046 Argv[Argc][
strlen(Argv[Argc])] =
' ';
2055 KdbpPrint(
"%s: Warning: Address %I64x is beeing truncated\n", Argv[0],
Result);
2065 DisplayOnlyOneModule =
TRUE;
2073 KdbpPrint(
" %p %08x %s\n", (
PVOID)ntoskrnlBase, 0,
"ntoskrnl.exe");
2111 if (Argv[0][0] ==
'i')
2118 KdbpPrint(
"Interrupt descriptor table is empty.\n");
2123 KdbpPrint(
" Idx Type Seg. Sel. Offset DPL\n");
2125 for (
i = 0; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2133 Dpl = ((SegDesc[1] >> 13) & 3);
2134 if ((SegDesc[1] & 0x1f00) == 0x0500)
2135 SegType =
"TASKGATE";
2136 else if ((SegDesc[1] & 0x1fe0) == 0x0e00)
2137 SegType =
"INTGATE32";
2138 else if ((SegDesc[1] & 0x1fe0) == 0x0600)
2139 SegType =
"INTGATE16";
2140 else if ((SegDesc[1] & 0x1fe0) == 0x0f00)
2141 SegType =
"TRAPGATE32";
2142 else if ((SegDesc[1] & 0x1fe0) == 0x0700)
2143 SegType =
"TRAPGATE16";
2145 SegType =
"UNKNOWN";
2147 if ((SegDesc[1] & (1 << 15)) == 0)
2149 KdbpPrint(
" %03d %-10s [NP] [NP] %02d\n",
2150 i / 8, SegType, Dpl);
2152 else if ((SegDesc[1] & 0x1f00) == 0x0500)
2154 SegSel = SegDesc[0] >> 16;
2156 i / 8, SegType, SegSel, Dpl);
2160 SegSel = SegDesc[0] >> 16;
2161 SegBase = (SegDesc[1] & 0xffff0000) | (SegDesc[0] & 0x0000ffff);
2162 KdbpPrint(
" %03d %-10s 0x%04x 0x%08x %02d\n",
2163 i / 8, SegType, SegSel, SegBase, Dpl);
2171 if (Argv[0][0] ==
'g')
2179 ASSERT(Argv[0][0] ==
'l');
2190 KdbpPrint(
"%s descriptor table is empty.\n",
2191 Argv[0][0] ==
'g' ?
"Global" :
"Local");
2195 KdbpPrint(
"%cDT Base: 0x%08x Limit: 0x%04x\n",
2196 Argv[0][0] ==
'g' ?
'G' :
'L', Reg.
Base, Reg.
Limit);
2197 KdbpPrint(
" Idx Sel. Type Base Limit DPL Attribs\n");
2199 for (; (
i +
sizeof(SegDesc) - 1) <= Reg.
Limit;
i += 8)
2207 Dpl = ((SegDesc[1] >> 13) & 3);
2208 Type = ((SegDesc[1] >> 8) & 0xf);
2210 SegBase = SegDesc[0] >> 16;
2211 SegBase |= (SegDesc[1] & 0xff) << 16;
2212 SegBase |= SegDesc[1] & 0xff000000;
2213 SegLimit = SegDesc[0] & 0x0000ffff;
2214 SegLimit |= (SegDesc[1] >> 16) & 0xf;
2216 if ((SegDesc[1] & (1 << 23)) != 0)
2226 if ((SegDesc[1] & (1 << 12)) == 0)
2230 case 1: SegType =
"TSS16(Avl)";
break;
2231 case 2: SegType =
"LDT";
break;
2232 case 3: SegType =
"TSS16(Busy)";
break;
2233 case 4: SegType =
"CALLGATE16";
break;
2234 case 5: SegType =
"TASKGATE";
break;
2235 case 6: SegType =
"INTGATE16";
break;
2236 case 7: SegType =
"TRAPGATE16";
break;
2237 case 9: SegType =
"TSS32(Avl)";
break;
2238 case 11: SegType =
"TSS32(Busy)";
break;
2239 case 12: SegType =
"CALLGATE32";
break;
2240 case 14: SegType =
"INTGATE32";
break;
2241 case 15: SegType =
"TRAPGATE32";
break;
2242 default: SegType =
"UNKNOWN";
break;
2252 else if ((SegDesc[1] & (1 << 11)) == 0)
2254 if ((SegDesc[1] & (1 << 22)) != 0)
2261 if ((SegDesc[1] & (1 << 22)) != 0)
2267 if ((SegDesc[1] & (1 << 15)) == 0)
2269 KdbpPrint(
" %03d 0x%04x %-11s [NP] [NP] %02d NP\n",
2270 i / 8,
i | Dpl | ul, SegType, Dpl);
2274 KdbpPrint(
" %03d 0x%04x %-11s 0x%08x 0x%08x %02d ",
2275 i / 8,
i | Dpl | ul, SegType, SegBase, SegLimit, Dpl);
2277 if ((SegDesc[1] & (1 << 12)) == 0)
2281 else if ((SegDesc[1] & (1 << 11)) == 0)
2283 if ((SegDesc[1] & (1 << 10)) != 0)
2286 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/W" :
" R");
2288 if ((SegDesc[1] & (1 << 8)) != 0)
2293 if ((SegDesc[1] & (1 << 10)) != 0)
2296 KdbpPrint((SegDesc[1] & (1 << 9)) ?
" R/X" :
" X");
2298 if ((SegDesc[1] & (1 << 8)) != 0)
2302 if ((SegDesc[1] & (1 << 20)) != 0)
2322 KdbpPrint(
"Current PCR is at 0x%p.\n", Pcr);
2324 KdbpPrint(
" Tib.ExceptionList: 0x%08x\n"
2325 " Tib.StackBase: 0x%08x\n"
2326 " Tib.StackLimit: 0x%08x\n"
2327 " Tib.SubSystemTib: 0x%08x\n"
2328 " Tib.FiberData/Version: 0x%08x\n"
2329 " Tib.ArbitraryUserPointer: 0x%08x\n"
2330 " Tib.Self: 0x%08x\n"
2331 " SelfPcr: 0x%08x\n"
2335 " IrrActive: 0x%08x\n"
2337 " KdVersionBlock: 0x%08x\n"
2341 " MajorVersion: 0x%04x\n"
2342 " MinorVersion: 0x%04x\n"
2343 " SetMember: 0x%08x\n"
2344 " StallScaleFactor: 0x%08x\n"
2346 " L2CacheAssociativity: 0x%02x\n"
2347 " VdmAlert: 0x%08x\n"
2348 " L2CacheSize: 0x%08x\n"
2349 " InterruptMode: 0x%08x\n"
2405 PCHAR Param, pszNext;
2409 if (Argv[1][0] ==
'*')
2412 ulValue =
strtoul(Param, &pszNext, 0);
2413 if (pszNext && *pszNext)
2415 KdbpPrint(
"Invalid TSS specification.\n");
2419 if (Argv[1][0] ==
'*')
2428 KdbpPrint(
"Invalid 32-bit TSS descriptor.\n");
2435 TssSelector = (
USHORT)ulValue;
2436 Tss = KdbpRetrieveTss(TssSelector,
NULL,
NULL);
2439 KdbpPrint(
"Invalid 32-bit TSS selector.\n");
2448 TssSelector = Ke386GetTr();
2453 KdbpPrint(
"%s TSS 0x%04x is at 0x%p.\n",
2454 (Tss ==
KeGetPcr()->TSS) ?
"Current" :
"Specified", TssSelector, Tss);
2456 " Ss0:Esp0: 0x%04x:0x%08x\n"
2477 " IoMapBase: 0x%04x\n",
2525 KdbpPrint(
"Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n");
2529 KdbpPrint(
"*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n",
2547 KdbpPrint(
"*** Dmesg: buffer rollup ***\n");
2550 KdbpPrint(
"*** Dmesg: end of output ***\n");
2570 static const PCHAR ExceptionNames[21] =
2572 "ZERODEVIDE",
"DEBUGTRAP",
"NMI",
"INT3",
"OVERFLOW",
"BOUND",
"INVALIDOP",
2573 "NOMATHCOP",
"DOUBLEFAULT",
"RESERVED(9)",
"INVALIDTSS",
"SEGMENTNOTPRESENT",
2574 "STACKFAULT",
"GPF",
"PAGEFAULT",
"RESERVED(15)",
"MATHFAULT",
"ALIGNMENTCHECK",
2575 "MACHINECHECK",
"SIMDFAULT",
"OTHERS"
2582 KdbpPrint(
" condition [exception|*] [first|last] [never|always|kmode|umode]\n");
2583 KdbpPrint(
" break_on_module_load [true|false]\n");
2585 else if (
strcmp(Argv[1],
"syntax") == 0)
2593 if (
_stricmp(Argv[2],
"intel") == 0)
2595 else if (
_stricmp(Argv[2],
"at&t") == 0)
2598 KdbpPrint(
"Unknown syntax '%s'.\n", Argv[2]);
2601 else if (
strcmp(Argv[1],
"condition") == 0)
2605 KdbpPrint(
"Conditions: (First) (Last)\n");
2608 if (!ExceptionNames[
l])
2617 KdbpPrint(
" #%02d %-20s %-8s %-8s\n",
l, ExceptionNames[
l],
2623 KdbpPrint(
" %-20s %-8s %-8s\n", ExceptionNames[
l],
2629 if (Argc >= 5 &&
strcmp(Argv[2],
"*") == 0)
2637 if (Argv[2] == pend)
2641 if (!ExceptionNames[
l])
2644 if (
_stricmp(ExceptionNames[
l], Argv[2]) == 0)
2651 KdbpPrint(
"Unknown exception '%s'.\n", Argv[2]);
2658 if (
_stricmp(Argv[3],
"first") == 0)
2660 else if (
_stricmp(Argv[3],
"last") == 0)
2664 KdbpPrint(
"set condition: second argument must be 'first' or 'last'\n");
2668 if (
_stricmp(Argv[4],
"never") == 0)
2670 else if (
_stricmp(Argv[4],
"always") == 0)
2672 else if (
_stricmp(Argv[4],
"umode") == 0)
2674 else if (
_stricmp(Argv[4],
"kmode") == 0)
2678 KdbpPrint(
"set condition: third argument must be 'never', 'always', 'umode' or 'kmode'\n");
2685 KdbpPrint(
"Couldn't change condition for exception #%02d\n",
l);
2687 KdbpPrint(
"Couldn't change condition for all exceptions\n",
l);
2700 KdbpPrint(
"Condition for exception #%02d (%s): FirstChance %s LastChance %s\n",
2701 l, ExceptionNames[
l],
2707 KdbpPrint(
"Condition for all other exceptions: FirstChance %s LastChance %s\n",
2714 else if (
strcmp(Argv[1],
"break_on_module_load") == 0)
2722 else if (
_stricmp(Argv[2],
"disable") == 0 ||
_stricmp(Argv[2],
"disabled") == 0 ||
_stricmp(Argv[2],
"false") == 0)
2725 KdbpPrint(
"Unknown setting '%s'.\n", Argv[2]);
2730 KdbpPrint(
"Unknown setting '%s'.\n", Argv[1]);
2745 KdbpPrint(
"Kernel debugger commands:\n");
2774 const unsigned char *
cp;
2778 cp = (
unsigned char *)
s +
n;
2781 if (*(--
cp) == (
unsigned char)
c)
2816 ULONG p0len = TermSize->cx * TermSize->cy;
2817 PCCH p0 = pCurPos - p0len;
2818 PCCH prev_p = p0, p1;
2828 for (
j = TermSize->cy;
j--; )
2841 linesCnt = (TermSize->cx+prev_p-
p-2) / TermSize->cx;
2898 LONG RowsPrintedByTerminal;
2908 if (!TerminalInitialized)
2910 TerminalInitialized =
TRUE;
2922 while (
p[0] !=
'\0')
2928 KdbPrintf(
"Dmesg: error, p > Buffer+BufLength,d=%d",
p - (
Buffer + BufLength));
2946 RowsPrintedByTerminal = 0;
2949 RowsPrintedByTerminal++;
2966 Prompt =
"--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---";
2968 Prompt =
"--- Press q to abort, any other key to continue ---";
2977 RowsPrintedByTerminal++;
3011 if (
p[
i] ==
'\n' &&
p[
i + 1] !=
'\0')
3213 static PCHAR Argv[256];
3214 static CHAR OrigCommand[1024];
3223 while (*
p ==
'\t' || *
p ==
' ')
3259 KdbpPrint(
"Command '%s' is unknown.\n", OrigCommand);
3274 static CHAR LastCommand[1024] =
"";
3276 if (EnteredOnSingleStep)
3309 else if (CmdLen > 1)
3349 DPRINT(
"KDB: Executing KDBinit file...\n");
3351 while (p1[0] !=
'\0')
3365 if (
strncmp(p2,
"break",
sizeof(
"break")-1) == 0 &&
3366 (p2[
sizeof(
"break")-1] ==
'\0' ||
isspace(p2[
sizeof(
"break")-1])))
3371 else if (p2[0] !=
'#' && p2[0] !=
'\0')
3380 while (p1[0] ==
'\r' || p1[0] ==
'\n')
3383 DPRINT(
"KDB: KDBinit executed\n");
3424 DPRINT(
"Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3430 &FileStdInfo,
sizeof(FileStdInfo),
3435 DPRINT(
"Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%x)",
Status);
3445 DPRINT(
"Could not allocate %d bytes for KDBinit file\n",
FileSize);
3456 DPRINT(
"Could not read KDBinit file into memory (Status 0x%lx)\n",
Status);
3574 else if (BootPhase == 1)
3606 " KDBG debugger enabled - %s\r\n",
3609 :
"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.
#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[])
#define Ke386GetLocalDescriptorTable
BOOLEAN ExpKdbgExtHandle(ULONG Argc, PCHAR Argv[])
static const struct @1811 KdbDebuggerCommands[]
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 struct @1810 ComponentTable[]
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,...)
#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
PULONG MinorVersion OPTIONAL
base of all file and directory entries
struct _KGDTENTRY::@2442::@2444 Bits
struct _KGDTENTRY::@2442::@2443 Bytes
union _KGDTENTRY::@2442 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::@2290 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