- Fix KiDispatchException to unmask KI_EXCEPTION_INTERNAL when setting the exception...
[reactos.git] / reactos / ntoskrnl / ke / bug.c
index f4ae4f6..dd19977 100644 (file)
@@ -18,8 +18,8 @@
 
 /* GLOBALS *******************************************************************/
 
-LIST_ENTRY BugcheckCallbackListHead;
-LIST_ENTRY BugcheckReasonCallbackListHead;
+LIST_ENTRY KeBugcheckCallbackListHead;
+LIST_ENTRY KeBugcheckReasonCallbackListHead;
 KSPIN_LOCK BugCheckCallbackLock;
 ULONG KeBugCheckActive, KeBugCheckOwner;
 LONG KeBugCheckOwnerRecursionCount;
@@ -99,7 +99,7 @@ KeRosDumpStackFrames(IN PULONG Frame OPTIONAL,
         }
 
         /* Print it out */
-        if (!KiRosPrintAddress((PVOID)Addr)) DbgPrint("<%X>", Addr);
+        if (!KeRosPrintAddress((PVOID)Addr)) DbgPrint("<%X>", Addr);
 
         /* Go to the next frame */
         DbgPrint("\n");
@@ -209,7 +209,7 @@ KiDoBugCheckCallbacks(VOID)
     ULONG_PTR Checksum;
 
     /* First make sure that the list is Initialized... it might not be */
-    ListHead = &BugcheckCallbackListHead;
+    ListHead = &KeBugcheckCallbackListHead;
     if ((ListHead->Flink) && (ListHead->Blink))
     {
         /* Loop the list */
@@ -819,7 +819,6 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
     }
 
     /* Check if we need to save the context for KD */
-    if (!KdPitchDebugger) KdDebuggerDataBlock.SavedContext = (ULONG)&Context;
 
     /* Check if a debugger is connected */
     if ((BugCheckCode != MANUALLY_INITIATED_CRASH) && (KdDebuggerEnabled))
@@ -854,6 +853,15 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
             /* Break in the debugger */
             KiBugCheckDebugBreak(DBG_STATUS_BUGCHECK_FIRST);
         }
+        else
+        {
+            /*
+             * ROS HACK.
+             * Ok, so debugging is enabled, but KDBG isn't there.
+             * We'll manually dump the stack for the user.
+             */
+            KeRosDumpStackFrames(NULL, 0);
+        }
     }
 
     /* Raise IRQL to HIGH_LEVEL */
@@ -893,12 +901,12 @@ KeBugCheckWithTf(IN ULONG BugCheckCode,
                             AnsiName);
 
         /* Check if the debugger is disabled but we can enable it */
-        if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
+        //if (!(KdDebuggerEnabled) && !(KdPitchDebugger))
         {
             /* Enable it */
-            KdEnableDebuggerWithLock(FALSE);
+            //KdEnableDebuggerWithLock(FALSE);
         }
-        else
+        //else
         {
             /* Otherwise, print the last line */
             InbvDisplayString("\r\n");
@@ -1033,7 +1041,7 @@ KeRegisterBugCheckCallback(IN PKBUGCHECK_CALLBACK_RECORD CallbackRecord,
         CallbackRecord->Component = Component;
         CallbackRecord->CallbackRoutine = CallbackRoutine;
         CallbackRecord->State = BufferInserted;
-        InsertTailList(&BugcheckCallbackListHead, &CallbackRecord->Entry);
+        InsertTailList(&KeBugcheckCallbackListHead, &CallbackRecord->Entry);
         Status = TRUE;
     }
 
@@ -1067,7 +1075,7 @@ KeRegisterBugCheckReasonCallback(
         CallbackRecord->CallbackRoutine = CallbackRoutine;
         CallbackRecord->State = BufferInserted;
         CallbackRecord->Reason = Reason;
-        InsertTailList(&BugcheckReasonCallbackListHead,
+        InsertTailList(&KeBugcheckReasonCallbackListHead,
                        &CallbackRecord->Entry);
         Status = TRUE;
     }