Commit in reactos/ntoskrnl on MAIN
include/internal/kd.h+3-11.23 -> 1.24
kd/dlog.c+33-11.12 -> 1.13
ke/bug.c+21-851.43 -> 1.44
+57-87
3 modified files

- Made KeBugCheckEx into a call to KeBugCheckExWithTf. 
- If file logging is in use then dump the last messages from the ringbuffer
on a bugcheck so the user can see them if the system was in graphics mode
when it crashed.

reactos/ntoskrnl/include/internal
kd.h 1.23 -> 1.24
diff -u -r1.23 -r1.24
--- kd.h	24 Feb 2004 21:25:41 -0000	1.23
+++ kd.h	11 Mar 2004 21:50:23 -0000	1.24
@@ -1,4 +1,4 @@
-/* $Id: kd.h,v 1.23 2004/02/24 21:25:41 weiden Exp $
+/* $Id: kd.h,v 1.24 2004/03/11 21:50:23 dwelch Exp $
  *
  * kernel debugger prototypes
  */
@@ -120,5 +120,7 @@
 KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord,
 			  PCONTEXT Context,
 			  PKTRAP_FRAME TrapFrame);
+VOID
+DebugLogDumpMessages(VOID);
 
 #endif /* __INCLUDE_INTERNAL_KERNEL_DEBUGGER_H */

reactos/ntoskrnl/kd
dlog.c 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- dlog.c	7 Mar 2004 04:38:41 -0000	1.12
+++ dlog.c	11 Mar 2004 21:50:23 -0000	1.13
@@ -1,4 +1,4 @@
-/* $Id: dlog.c,v 1.12 2004/03/07 04:38:41 dwelch Exp $
+/* $Id: dlog.c,v 1.13 2004/03/11 21:50:23 dwelch Exp $
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
@@ -35,6 +35,38 @@
 
 /* FUNCTIONS *****************************************************************/
 
+VOID
+DebugLogDumpMessages(VOID)
+{
+  static CHAR Buffer[256];
+  ULONG Offset;
+  ULONG Length;
+
+  if (!(KdDebugState & KD_DEBUG_FILELOG))
+    {
+      return;
+    }
+  KdDebugState &= ~KD_DEBUG_FILELOG;
+ 
+  Offset = (DebugLogEnd + 1) % DEBUGLOG_SIZE;
+  do
+    {
+      if (Offset <= DebugLogEnd)
+	{
+	  Length = min(255, DebugLogEnd - Offset);
+	}
+      else
+	{
+	  Length = min(255, DEBUGLOG_SIZE - Offset);
+	}
+      memcpy(Buffer, DebugLog + Offset, Length);
+      Buffer[Length] = 0;
+      DbgPrint(Buffer);
+      Offset = (Offset + Length) % DEBUGLOG_SIZE;
+    }
+  while (Length > 0);
+}
+
 VOID INIT_FUNCTION
 DebugLogInit(VOID)
 {

reactos/ntoskrnl/ke
bug.c 1.43 -> 1.44
diff -u -r1.43 -r1.44
--- bug.c	9 Mar 2004 21:49:53 -0000	1.43
+++ bug.c	11 Mar 2004 21:50:24 -0000	1.44
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: bug.c,v 1.43 2004/03/09 21:49:53 dwelch Exp $
+/* $Id: bug.c,v 1.44 2004/03/11 21:50:24 dwelch Exp $
  *
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/bug.c
@@ -104,6 +104,7 @@
     }
 
   Ke386DisableInterrupts();
+  DebugLogDumpMessages();
 
   if (KeGetCurrentIrql() < DISPATCH_LEVEL)
     {
@@ -138,8 +139,23 @@
       DbgPrint("Recursive bug check halting now\n");
       Ke386HaltProcessor();
     }
-  InBugCheck = 1;
-  KiDumpTrapFrame(Tf, BugCheckParameter1, BugCheckParameter2);
+  InBugCheck = 1;  
+  if (Tf != NULL)
+    {
+      KiDumpTrapFrame(Tf, BugCheckParameter1, BugCheckParameter2);
+    }
+  else
+    {
+#if defined(__GNUC__)
+      KeDumpStackFrames((PULONG)__builtin_frame_address(0));
+#elif defined(_MSC_VER)
+      __asm push ebp
+      __asm call KeDumpStackFrames
+      __asm add esp, 4
+#else
+#error Unknown compiler for inline assembler
+#endif
+    }
   MmDumpToPagingFile(BugCheckCode, BugCheckParameter1, 
 		     BugCheckParameter2, BugCheckParameter3,
 		     BugCheckParameter4, Tf);
@@ -175,88 +191,8 @@
  * RETURNS: Doesn't
  */
 {
-  PRTL_MESSAGE_RESOURCE_ENTRY Message;
-  NTSTATUS Status;
-  KIRQL OldIrql;
-
-  /* Make sure we're switching back to the blue screen and print messages on it */
-  HalReleaseDisplayOwnership();
-  if (0 == (KdDebugState & KD_DEBUG_GDB))
-    {
-      KdDebugState |= KD_DEBUG_SCREEN;
-    }
-
-  Ke386DisableInterrupts();
-
-  if (KeGetCurrentIrql() < DISPATCH_LEVEL)
-    {
-      KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
-    }
-  DbgPrint("Bug detected (code %x param %x %x %x %x)\n",
-	   BugCheckCode,
-	   BugCheckParameter1,
-	   BugCheckParameter2,
-	   BugCheckParameter3,
-	   BugCheckParameter4);
-
-  Status = RtlFindMessage((PVOID)KERNEL_BASE, //0xC0000000,
-			  11, //RT_MESSAGETABLE,
-			  0x09, //0x409,
-			  BugCheckCode,
-			  &Message);
-  if (NT_SUCCESS(Status))
-    {
-      if (Message->Flags == 0)
-	DbgPrint("  %s\n", Message->Text);
-      else
-	DbgPrint("  %S\n", (PWSTR)Message->Text);
-    }
-  else
-    {
-      DbgPrint("  No message text found!\n\n");
-    }
-
-  if (InBugCheck == 1)
-    {
-      DbgPrint("Recursive bug check halting now\n");
-      Ke386HaltProcessor();
-    }
-  InBugCheck = 1;
-  if (PsGetCurrentProcess() != NULL)
-    {
-      DbgPrint("Pid: %x <", PsGetCurrentProcess()->UniqueProcessId);
-      DbgPrint("%.8s> ", PsGetCurrentProcess()->ImageFileName);
-    }
-  if (PsGetCurrentThread() != NULL)
-    {
-      DbgPrint("Thrd: %x Tid: %x\n",
-	       PsGetCurrentThread(),
-	       PsGetCurrentThread()->Cid.UniqueThread);
-    }
-#if defined(__GNUC__)
-  KeDumpStackFrames((PULONG)__builtin_frame_address(0));
-#elif defined(_MSC_VER)
-  __asm push ebp
-  __asm call KeDumpStackFrames
-  __asm add esp, 4
-#else
-#error Unknown compiler for inline assembler
-#endif
-  MmDumpToPagingFile(BugCheckCode, BugCheckParameter1, 
-		     BugCheckParameter2, BugCheckParameter3,
-		     BugCheckParameter4, NULL);
-
-  if (KdDebuggerEnabled)
-    {
-      Ke386EnableInterrupts();
-      DbgBreakPointNoBugCheck();
-      Ke386DisableInterrupts();
-    }
-
-  for (;;)
-    {
-      Ke386HaltProcessor();
-    }
+  KeBugCheckWithTf(BugCheckCode, BugCheckParameter1, BugCheckParameter2,
+		   BugCheckParameter3, BugCheckParameter4, NULL);
 }
 
 /*
CVSspam 0.2.8