[CMAKE]
[reactos.git] / ntoskrnl / kdbg / kdb_cli.c
index fa42826..a45009c 100644 (file)
@@ -220,8 +220,6 @@ KdbpGetComponentId(
         { "SERIAL", DPFLTR_SERIAL_ID },
         { "SERENUM", DPFLTR_SERENUM_ID },
         { "UHCD", DPFLTR_UHCD_ID },
-        { "BOOTOK", DPFLTR_BOOTOK_ID },
-        { "BOOTVRFY", DPFLTR_BOOTVRFY_ID },
         { "RPCPROXY", DPFLTR_RPCPROXY_ID },
         { "AUTOCHK", DPFLTR_AUTOCHK_ID },
         { "DCOMSS", DPFLTR_DCOMSS_ID },
@@ -272,7 +270,60 @@ KdbpGetComponentId(
         { "STORPORT", DPFLTR_STORPORT_ID },
         { "STORMINIPORT", DPFLTR_STORMINIPORT_ID },
         { "PRINTSPOOLER", DPFLTR_PRINTSPOOLER_ID },
-   };
+        { "VSSDYNDISK", DPFLTR_VSSDYNDISK_ID },
+        { "VERIFIER", DPFLTR_VERIFIER_ID },
+        { "VDS", DPFLTR_VDS_ID },
+        { "VDSBAS", DPFLTR_VDSBAS_ID },
+        { "VDSDYN", DPFLTR_VDSDYN_ID },
+        { "VDSDYNDR", DPFLTR_VDSDYNDR_ID },
+        { "VDSLDR", DPFLTR_VDSLDR_ID },
+        { "VDSUTIL", DPFLTR_VDSUTIL_ID },
+        { "DFRGIFC", DPFLTR_DFRGIFC_ID },
+        { "MM", DPFLTR_MM_ID },
+        { "DFSC", DPFLTR_DFSC_ID },
+        { "WOW64", DPFLTR_WOW64_ID },
+        { "ALPC", DPFLTR_ALPC_ID },
+        { "WDI", DPFLTR_WDI_ID },
+        { "PERFLIB", DPFLTR_PERFLIB_ID },
+        { "KTM", DPFLTR_KTM_ID },
+        { "IOSTRESS", DPFLTR_IOSTRESS_ID },
+        { "HEAP", DPFLTR_HEAP_ID },
+        { "WHEA", DPFLTR_WHEA_ID },
+        { "USERGDI", DPFLTR_USERGDI_ID },
+        { "MMCSS", DPFLTR_MMCSS_ID },
+        { "TPM", DPFLTR_TPM_ID },
+        { "THREADORDER", DPFLTR_THREADORDER_ID },
+        { "ENVIRON", DPFLTR_ENVIRON_ID },
+        { "EMS", DPFLTR_EMS_ID },
+        { "WDT", DPFLTR_WDT_ID },
+        { "FVEVOL", DPFLTR_FVEVOL_ID },
+        { "NDIS", DPFLTR_NDIS_ID },
+        { "NVCTRACE", DPFLTR_NVCTRACE_ID },
+        { "LUAFV", DPFLTR_LUAFV_ID },
+        { "APPCOMPAT", DPFLTR_APPCOMPAT_ID },
+        { "USBSTOR", DPFLTR_USBSTOR_ID },
+        { "SBP2PORT", DPFLTR_SBP2PORT_ID },
+        { "COVERAGE", DPFLTR_COVERAGE_ID },
+        { "CACHEMGR", DPFLTR_CACHEMGR_ID },
+        { "MOUNTMGR", DPFLTR_MOUNTMGR_ID },
+        { "CFR", DPFLTR_CFR_ID },
+        { "TXF", DPFLTR_TXF_ID },
+        { "KSECDD", DPFLTR_KSECDD_ID },
+        { "FLTREGRESS", DPFLTR_FLTREGRESS_ID },
+        { "MPIO", DPFLTR_MPIO_ID },
+        { "MSDSM", DPFLTR_MSDSM_ID },
+        { "UDFS", DPFLTR_UDFS_ID },
+        { "PSHED", DPFLTR_PSHED_ID },
+        { "STORVSP", DPFLTR_STORVSP_ID },
+        { "LSASS", DPFLTR_LSASS_ID },
+        { "SSPICLI", DPFLTR_SSPICLI_ID },
+        { "CNG", DPFLTR_CNG_ID },
+        { "EXFAT", DPFLTR_EXFAT_ID },
+        { "FILETRACE", DPFLTR_FILETRACE_ID },
+        { "XSAVE", DPFLTR_XSAVE_ID },
+        { "SE", DPFLTR_SE_ID },
+        { "DRIVEEXTENDER", DPFLTR_DRIVEEXTENDER_ID },
+    };
 
     for (i = 0; i < sizeof(ComponentTable) / sizeof(ComponentTable[0]); i++)
     {
@@ -739,7 +790,6 @@ KdbpCmdBackTrace(
     ULONG Argc,
     PCHAR Argv[])
 {
-    ULONG Count;
     ULONG ul;
     ULONGLONG Result = 0;
     ULONG_PTR Frame = KdbCurrentTrapFrame->Tf.Ebp;
@@ -755,7 +805,6 @@ KdbpCmdBackTrace(
             ul = strtoul(Argv[Argc-1], NULL, 0);
             if (ul > 0)
             {
-                Count = ul;
                 Argc -= 2;
             }
         }
@@ -764,7 +813,6 @@ KdbpCmdBackTrace(
             ul = strtoul(Argv[Argc-1] + 1, NULL, 0);
             if (ul > 0)
             {
-                Count = ul;
                 Argc--;
             }
         }
@@ -823,11 +871,14 @@ KdbpCmdBackTrace(
             break;
         }
 
-        if (!KdbSymPrintAddress((PVOID)Address))
+        /* Print the location of the call instruction */
+        if (!KdbSymPrintAddress((PVOID)(Address - 5)))
             KdbpPrint("<%08x>\n", Address);
         else
             KdbpPrint("\n");
 
+        if (KdbOutputAborted) break;
+
         if (Address == 0)
             break;
 
@@ -1222,7 +1273,13 @@ KdbpCmdThread(
                 str2 = "";
             }
 
-            if (Thread->Tcb.TrapFrame)
+            if (!Thread->Tcb.InitialStack)
+            {
+                /* Thread has no kernel stack (probably terminated) */
+                Esp = Ebp = NULL;
+                Eip = 0;
+            }
+            else if (Thread->Tcb.TrapFrame)
             {
                 if (Thread->Tcb.TrapFrame->PreviousPreviousMode == KernelMode)
                     Esp = (PULONG)Thread->Tcb.TrapFrame->TempEsp;
@@ -2433,14 +2490,12 @@ KdbpReadCommand(
              */
             if (Buffer == Orig)
             {
-                strncpy(Buffer, LastCommand, Size);
-                Buffer[Size - 1] = '\0';
+                RtlStringCbCopyA(Buffer, Size, LastCommand);
             }
             else
             {
                 *Buffer = '\0';
-                strncpy(LastCommand, Orig, sizeof (LastCommand));
-                LastCommand[sizeof (LastCommand) - 1] = '\0';
+                RtlStringCbCopyA(LastCommand, sizeof(LastCommand), Orig);
             }
 
             return;
@@ -2557,8 +2612,7 @@ KdbpDoCommand(
     static PCH Argv[256];
     static CHAR OrigCommand[1024];
 
-    strncpy(OrigCommand, Command, sizeof(OrigCommand) - 1);
-    OrigCommand[sizeof(OrigCommand) - 1] = '\0';
+    RtlStringCbCopyA(OrigCommand, sizeof(OrigCommand), Command);
 
     Argc = 0;
     p = Command;
@@ -2652,6 +2706,7 @@ KdbpCliMainLoop(
 
         /* Call the command */
         Continue = KdbpDoCommand(Command);
+        KdbOutputAborted = FALSE;
     }
     while (Continue);
 }