I suspect this broke the GDB stub the same way as it was broken a few days ago. When continueing, ReactOS crashes.
KeBugCheckWithTf at ke/catch.c:171 Bug detected (code 1e param 0 0 0 0) KMODE_EXCEPTION_NOT_HANDLED
Breakpoint Exception: 3(0) Processor: 0 CS:EIP 8:c00051df <ntoskrnl.exe: 51df> cr2 0 cr3 2ae000 Proc: c02b9010 Pid: 1 <SYSTEM> Thrd: c02b9d80 Tid: 1 DS 10 ES 10 FS 30 GS 10 EAX: 00000001 EBX: 0000940e ECX: c02b9d68 EDX: 000003f8 EBP: c00b8d60 ESI: 002b4000 ESP: c00b8cec EDI: 00000f00 EFLAGS: 00200296 kESP c00b8cec kernel stack base c00b6000 Frames: <C0084080>
if (Value != ExceptionContinueExecution || 0 != (ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE)) { DPRINT("ExceptionRecord->ExceptionAddress = 0x%x\n", ExceptionRecord->ExceptionAddress ); #ifdef KDBG KdbEnterDebuggerException (ExceptionRecord, PreviousMode, Context, Tf, TRUE); #endif KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, 0, 0, 0, 0, Tf); /* catch.c:171 */ }
config: DBG=1, KDBG=0
Casper
_____
From: ros-diffs-bounces@reactos.com [mailto:ros-diffs-bounces@reactos.com] On Behalf Of arty@osexperts.com Sent: 18. november 2004 03:10 To: ros-diffs@reactos.com Subject: [ros-diffs] [CVS reactos] Changed kdbg a bit by adding some new flags (and a new command):
Commit in reactos/ntoskrnl on MAIN ke/catch.c <> +23 -17 1.53 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c?rev=1.53&content-type=text/x-cvsweb-markup - http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c.diff?r1=text&tr1=1.53&r2=text&tr2=1.54&f=h > 1.54 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c?rev=1.54&content-type=text/x-cvsweb-markup dbg/kdb.c <> +40 -2 1.34 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c?rev=1.34&content-type=text/x-cvsweb-markup - http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c.diff?r1=text&tr1=1.34&r2=text&tr2=1.35&f=h > 1.35 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c?rev=1.35&content-type=text/x-cvsweb-markup +63 -19 2 modified files
Changed kdbg a bit by adding some new flags (and a new command):
condition [all|umode|kmode]
condition all -> Handle all exceptions. This is like the current kdbg
condition umode -> Handle unhandled usermode exceptions and all kmode
exceptions.
condition kmode -> Handle only unhandled kernelmode exceptions (default) _____
reactos http://cvs.reactos.com/cgi-bin/cvsweb/reactos /ntoskrnl http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl /ke http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke
catch.c 1.53 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c?rev=1.53&content-type=text/x-cvsweb-markup - http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c.diff?r1=text&tr1=1.53&r2=text&tr2=1.54&f=h > 1.54 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/ke/catch.c?rev=1.54&content-type=text/x-cvsweb-markup diff -u -r1.53 -r1.54
--- catch.c 14 Nov 2004 16:00:02 -0000 1.53
+++ catch.c 18 Nov 2004 02:10:28 -0000 1.54
@@ -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: catch.c,v 1.53 2004/11/14 16:00:02 blight Exp $ +/* $Id: catch.c,v 1.54 2004/11/18 02:10:28 arty Exp $ *
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/ke/catch.c @@ -76,17 +76,8 @@
{
Action = KdEnterDebuggerException (ExceptionRecord, Context, Tf);
} -#ifdef KDBG
- else if (KdDebuggerEnabled && KdDebugState & KD_DEBUG_KDB)
- {
- Action = KdbEnterDebuggerException (ExceptionRecord, Context, Tf);
- }
-#endif /* KDBG */
- if (Action == kdContinue)
- {
- return;
- }
- else if (Action != kdDoNotHandleException) +
+ if (Action != kdDoNotHandleException) {
if (PreviousMode == UserMode)
{ @@ -98,6 +89,11 @@
PULONG pNewUserStack = (PULONG)(Tf->Esp - (12 + sizeof(EXCEPTION_RECORD) + sizeof(CONTEXT)));
NTSTATUS StatusOfCopy;
+#ifdef KDBG
+ KdbEnterDebuggerException (ExceptionRecord, PreviousMode,
+ Context, Tf, FALSE);
+#endif
+ /* FIXME: Forward exception to user mode debugger */
/* FIXME: Check user mode stack for enough space */ @@ -139,17 +135,23 @@
/* FIXME: Forward the exception to the process exception port */
+#ifdef KDBG
+ KdbEnterDebuggerException (ExceptionRecord, PreviousMode,
+ Context, Tf, TRUE);
+#endif
+ /* Terminate the offending thread */
DPRINT1("Unhandled UserMode exception, terminating thread\n");
ZwTerminateThread(NtCurrentThread(), ExceptionRecord->ExceptionCode); -
- /* If that fails then bugcheck */
- DPRINT1("Could not terminate thread\n");
- KEBUGCHECK(KMODE_EXCEPTION_NOT_HANDLED); }
else
{
/* PreviousMode == KernelMode */ +#ifdef KDBG
+ KdbEnterDebuggerException (ExceptionRecord, PreviousMode,
+ Context, Tf, FALSE);
+#endif
+ Value = RtlpDispatchException (ExceptionRecord, Context);
DPRINT("RtlpDispatchException() returned with 0x%X\n", Value); @@ -162,7 +164,11 @@
{
DPRINT("ExceptionRecord->ExceptionAddress = 0x%x\n",
ExceptionRecord->ExceptionAddress ); - KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, 0, 0, 0, 0, Tf); +#ifdef KDBG
+ KdbEnterDebuggerException (ExceptionRecord, PreviousMode,
+ Context, Tf, TRUE);
+#endif
+ KEBUGCHECKWITHTF(KMODE_EXCEPTION_NOT_HANDLED, 0, 0, 0, 0, Tf); }
}
} _____
reactos http://cvs.reactos.com/cgi-bin/cvsweb/reactos /ntoskrnl http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl /dbg http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg
kdb.c 1.34 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c?rev=1.34&content-type=text/x-cvsweb-markup - http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c.diff?r1=text&tr1=1.34&r2=text&tr2=1.35&f=h > 1.35 http://cvs.reactos.com/cgi-bin/cvsweb/reactos/ntoskrnl/dbg/kdb.c?rev=1.35&content-type=text/x-cvsweb-markup diff -u -r1.34 -r1.35
--- kdb.c 10 Nov 2004 23:16:16 -0000 1.34
+++ kdb.c 18 Nov 2004 02:10:28 -0000 1.35
@@ -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.34 2004/11/10 23:16:16 blight Exp $ +/* $Id: kdb.c,v 1.35 2004/11/18 02:10:28 arty Exp $ *
* PROJECT: ReactOS kernel
* FILE: ntoskrnl/dbg/kdb.c @@ -58,6 +58,8 @@
static KDB_ACTIVE_BREAKPOINT
KdbActiveBreakPoints[KDB_MAXIMUM_BREAKPOINT_COUNT];
+static BOOLEAN KdbHandleUmode = FALSE;
+static BOOLEAN KdbHandleHandled = FALSE; static BOOLEAN KdbIgnoreNextSingleStep = FALSE;
static ULONG KdbLastSingleStepFrom = 0xFFFFFFFF; @@ -70,6 +72,8 @@
PsDumpThreads(BOOLEAN System);
ULONG
DbgContCommand(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf); +ULONG
+DbgStopCondition(ULONG Aargc, PCH Argv[], PKTRAP_FRAME Tf); ULONG
DbgEchoToggle(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf);
ULONG @@ -124,6 +128,8 @@
} DebuggerCommands[] = {
{"cont", "cont", "Exit the debugger", DbgContCommand},
{"echo", "echo", "Toggle serial echo", DbgEchoToggle}, + {"condition", "condition [all|umode|kmode]", "Kdbg enter condition", DbgStopCondition},
+ {"regs", "regs", "Display general purpose registers", DbgRegsCommand},
{"dregs", "dregs", "Display debug registers", DbgDRegsCommand},
{"cregs", "cregs", "Display control registers", DbgCRegsCommand}, @@ -1329,6 +1335,24 @@
}
ULONG +DbgStopCondition(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
+{
+ if( Argc == 1 ) {
+ if( KdbHandleHandled ) DbgPrint("all\n");
+ else if( KdbHandleUmode ) DbgPrint("umode\n");
+ else DbgPrint("kmode\n");
+ }
+ else if( !strcmp(Argv[1],"all") )
+ { KdbHandleHandled = TRUE; KdbHandleUmode = TRUE; }
+ else if( !strcmp(Argv[1],"umode") )
+ { KdbHandleHandled = FALSE; KdbHandleUmode = TRUE; }
+ else if( !strcmp(Argv[1],"kmode") )
+ { KdbHandleHandled = FALSE; KdbHandleUmode = FALSE; }
+
+ return(TRUE);
+}
+
+ULONG DbgEchoToggle(ULONG Argc, PCH Argv[], PKTRAP_FRAME Tf)
{
KbdEchoOn = !KbdEchoOn; @@ -1624,12 +1648,26 @@
KD_CONTINUE_TYPE
KdbEnterDebuggerException(PEXCEPTION_RECORD ExceptionRecord, + KPROCESSOR_MODE PreviousMode, PCONTEXT Context, - PKTRAP_FRAME TrapFrame) + PKTRAP_FRAME TrapFrame,
+ BOOLEAN AlwaysHandle) {
LONG BreakPointNr;
ULONG ExpNr = (ULONG)TrapFrame->DebugArgMark;
+ DbgPrint( ":KDBG:Entered:%s:%s\n",
+ PreviousMode==KernelMode ? "kmode" : "umode",
+ AlwaysHandle ? "always" : "if-unhandled" );
+
+ /* If we aren't handling umode exceptions then return */
+ if( PreviousMode == UserMode && !KdbHandleUmode && !AlwaysHandle )
+ return kdContinue;
+
+ /* If the exception would be unhandled (and we care) then handle it */
+ if( PreviousMode == KernelMode && !KdbHandleHandled && !AlwaysHandle )
+ return kdContinue;
+ /* Exception inside the debugger? Game over. */
if (KdbEntryCount > 0)
{ CVSspam http://www.badgers-in-foil.co.uk/projects/cvsspam/ 0.2.8