From owner-freebsd-current Sun Dec 27 16:34:09 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA26093 for freebsd-current-outgoing; Sun, 27 Dec 1998 16:34:09 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA26088 for ; Sun, 27 Dec 1998 16:34:07 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id TAA20406 for ; Sun, 27 Dec 1998 19:33:56 -0500 (EST) Date: Sun, 27 Dec 1998 19:33:56 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: current@FreeBSD.ORG Subject: debugger_on_panic behavior changes (for the better) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG There's something that's been bugging me for a while, so I decided to fix it. FreeBSD now will DTRT WRT DDB and DDB_UNATTENDED (!debugger_on_panic), at least in my opinion. The behavior change is such that: 1. Nothing changes when debugger_on_panic != 0. 2. When DDB_UNATTENDED (!debugger_on_panic), if a panic occurs, the machine will reboot. Also, if a trap occurs, the machine will panic and reboot, unlike how it broke to DDB before. HOWEVER, a trap inside DDB will not cause a panic, allowing full use of DDB without having to worry about the machine being stuck at a DDB prompt if something goes wrong during the day. Patches for this behavior follow my signature, and it would be a boon to anyone (like me) who uses DDB_UNATTENDED, but actually wants the machine to panic on a trap (otherwise, what's the use, if the machine causes a fatal trap rather than a true panic, of debugger_on_panic?). The changes cause no adverse behavior, but do involve two symbols becoming global (shouldn't be that bad of pollution). Comments? Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ --- src/sys/kern/kern_shutdown.c.orig Sun Dec 27 15:00:08 1998 +++ src/sys/kern/kern_shutdown.c Sun Dec 27 15:01:51 1998 @@ -80,9 +80,9 @@ #ifdef DDB #ifdef DDB_UNATTENDED -static int debugger_on_panic = 0; +int debugger_on_panic = 0; #else -static int debugger_on_panic = 1; +int debugger_on_panic = 1; #endif SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RW, &debugger_on_panic, 0, ""); --- src/sys/i386/i386/trap.c.orig Sun Dec 27 14:47:39 1998 +++ src/sys/i386/i386/trap.c Sun Dec 27 15:01:01 1998 @@ -93,6 +93,10 @@ #include #endif +#ifdef DDB + extern int in_Debugger, debugger_on_panic; +#endif + #include "isa.h" #include "npx.h" @@ -901,7 +905,7 @@ return; #endif #ifdef DDB - if (kdb_trap (type, 0, frame)) + if ((debugger_on_panic || in_Debugger) && kdb_trap(type, 0, frame)) return; #endif printf("trap number = %d\n", type); --- src/sys/i386/i386/db_interface.c.orig Sun Dec 27 14:45:51 1998 +++ src/sys/i386/i386/db_interface.c Sun Dec 27 14:56:54 1998 @@ -295,11 +295,12 @@ * Move this to machdep.c and allow it to be called if any debugger is * installed. */ +volatile int in_Debugger = 0; + void Debugger(msg) const char *msg; { - static volatile u_char in_Debugger; /* * XXX To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message