- Make Kdbg "bugcheck" command work -- Kdbg isn't re-entrant, so defer the bugcheck...
authorStefan Ginsberg <stefanginsberg@gmail.com>
Thu, 6 Nov 2008 18:33:56 +0000 (18:33 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Thu, 6 Nov 2008 18:33:56 +0000 (18:33 +0000)
svn path=/trunk/; revision=37227

reactos/ntoskrnl/kdbg/kdb.c
reactos/ntoskrnl/kdbg/kdb_cli.c

index 3876bf1..faced12 100644 (file)
@@ -51,6 +51,7 @@ PKDB_KTRAP_FRAME KdbCurrentTrapFrame = NULL; /* Pointer to the current trapframe
 STATIC KDB_KTRAP_FRAME KdbTrapFrame = { { 0 } };  /* The trapframe which was passed to KdbEnterDebuggerException */
 STATIC KDB_KTRAP_FRAME KdbThreadTrapFrame = { { 0 } }; /* The trapframe of the current thread (KdbCurrentThread) */
 STATIC KAPC_STATE KdbApcState;
+extern BOOLEAN KdbpBugCheckRequested;
 
 /* Array of conditions when to enter KDB */
 STATIC KDB_ENTER_CONDITION KdbEnterConditions[][2] =
@@ -1601,6 +1602,13 @@ KdbEnterDebuggerException(
    /* Leave critical section */
    Ke386RestoreFlags(OldEflags);
 
+   /* Check if user requested a bugcheck */
+   if (KdbpBugCheckRequested)
+   {
+       /* Bugcheck the system */
+       KeBugCheck(MANUALLY_INITIATED_CRASH);
+   }
+
 continue_execution:
    /* Clear debug status */
    if (ExceptionCode == STATUS_BREAKPOINT) /* FIXME: Why clear DR6 on INT3? */
index fd7acee..dac9a13 100644 (file)
@@ -99,6 +99,7 @@ STATIC LONG KdbNumberOfRowsTerminal = -1;
 STATIC LONG KdbNumberOfColsTerminal = -1;
 
 PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */
+BOOLEAN KdbpBugCheckRequested = FALSE;
 
 STATIC CONST struct
 {
@@ -1689,9 +1690,9 @@ KdbpCmdTss(ULONG Argc, PCHAR Argv[])
 STATIC BOOLEAN
 KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[])
 {
-   /* Bugcheck the system */
-   KeBugCheck(MANUALLY_INITIATED_CRASH);
-   return TRUE;
+   /* Set the flag and quit looping */
+   KdbpBugCheckRequested = TRUE;
+   return FALSE;
 }
 
 /*!\brief Sets or displays a config variables value.