From 6f9d1917af3e498e2d1237a17a54c6ed71242101 Mon Sep 17 00:00:00 2001 From: Gregor Anich Date: Wed, 10 Nov 2004 23:16:16 +0000 Subject: [PATCH] Print exception names/strings when KDB is entered. svn path=/trunk/; revision=11612 --- reactos/ntoskrnl/dbg/kdb.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/dbg/kdb.c b/reactos/ntoskrnl/dbg/kdb.c index 233e9e4a92a..6295d956153 100644 --- a/reactos/ntoskrnl/dbg/kdb.c +++ b/reactos/ntoskrnl/dbg/kdb.c @@ -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: kdb.c,v 1.33 2004/10/30 23:48:55 navaraf Exp $ +/* $Id: kdb.c,v 1.34 2004/11/10 23:16:16 blight Exp $ * * PROJECT: ReactOS kernel * FILE: ntoskrnl/dbg/kdb.c @@ -153,6 +153,30 @@ struct {NULL, NULL, NULL} }; +static const char *ExceptionTypeStrings[] = + { + "Divide Error", + "Debug Trap", + "NMI", + "Breakpoint", + "Overflow", + "BOUND range exceeded", + "Invalid Opcode", + "No Math Coprocessor", + "Double Fault", + "Unknown(9)", + "Invalid TSS", + "Segment Not Present", + "Stack Segment Fault", + "General Protection", + "Page Fault", + "Reserved(15)", + "Math Fault", + "Alignment Check", + "Machine Check", + "SIMD Fault" + }; + volatile DWORD x_dr0 = 0, x_dr1 = 0, x_dr2 = 0, x_dr3 = 0, x_dr7 = 0; extern LONG KdbDisassemble(ULONG Address); @@ -1679,7 +1703,11 @@ KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, } else { - DbgPrint("Entered debugger on exception number %d.\n", ExpNr); + const char *ExceptionString = + (ExpNr < (sizeof (ExceptionTypeStrings) / sizeof (ExceptionTypeStrings[0]))) ? + (ExceptionTypeStrings[ExpNr]) : + ("Unknown/User defined exception"); + DbgPrint("Entered debugger on exception number %d (%s)\n", ExpNr, ExceptionString); } KdbInternalEnter(TrapFrame); KdbEntryCount--;