diff options
author | msmith <msmith@FreeBSD.org> | 1998-12-28 23:03:00 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-12-28 23:03:00 +0000 |
commit | 981941d4060eac90f2a4487b0b968ccccc1aa9aa (patch) | |
tree | 01bd1afc7e6da245f5ace02fd85aaa4a9d0ff2cb /sys | |
parent | 448471aa29ad0e51620b7b82116fd6d0b5453c3b (diff) | |
download | FreeBSD-src-981941d4060eac90f2a4487b0b968ccccc1aa9aa.zip FreeBSD-src-981941d4060eac90f2a4487b0b968ccccc1aa9aa.tar.gz |
Improved DDB_UNATTENDED behaviour. From the submitter:
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
Submitted by: Brian Feldman <green@unixhelp.org>
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/db_interface.c | 5 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 8 | ||||
-rw-r--r-- | sys/i386/i386/db_interface.c | 5 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 8 | ||||
-rw-r--r-- | sys/kern/kern_shutdown.c | 6 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 8 |
6 files changed, 27 insertions, 13 deletions
diff --git a/sys/amd64/amd64/db_interface.c b/sys/amd64/amd64/db_interface.c index 0b53ed23..7f01f1d 100644 --- a/sys/amd64/amd64/db_interface.c +++ b/sys/amd64/amd64/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.41 1998/06/08 09:23:24 dfr Exp $ + * $Id: db_interface.c,v 1.42 1998/12/14 05:34:33 dillon Exp $ */ /* @@ -295,11 +295,12 @@ db_write_bytes(addr, size, data) * 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 diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 3d35483..e672368 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $ + * $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $ */ /* @@ -93,6 +93,10 @@ #include <machine/vm86.h> #endif +#ifdef DDB + extern int in_Debugger, debugger_on_panic; +#endif + #include "isa.h" #include "npx.h" @@ -901,7 +905,7 @@ trap_fatal(frame, eva) 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); diff --git a/sys/i386/i386/db_interface.c b/sys/i386/i386/db_interface.c index 0b53ed23..7f01f1d 100644 --- a/sys/i386/i386/db_interface.c +++ b/sys/i386/i386/db_interface.c @@ -23,7 +23,7 @@ * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. * - * $Id: db_interface.c,v 1.41 1998/06/08 09:23:24 dfr Exp $ + * $Id: db_interface.c,v 1.42 1998/12/14 05:34:33 dillon Exp $ */ /* @@ -295,11 +295,12 @@ db_write_bytes(addr, size, data) * 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 diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 3d35483..e672368 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $ + * $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $ */ /* @@ -93,6 +93,10 @@ #include <machine/vm86.h> #endif +#ifdef DDB + extern int in_Debugger, debugger_on_panic; +#endif + #include "isa.h" #include "npx.h" @@ -901,7 +905,7 @@ trap_fatal(frame, eva) 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); diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 3a2c650..4d6db41 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94 - * $Id: kern_shutdown.c,v 1.42 1998/11/13 22:40:37 msmith Exp $ + * $Id: kern_shutdown.c,v 1.43 1998/12/04 22:54:51 archie Exp $ */ #include "opt_ddb.h" @@ -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, ""); diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 3d35483..e672368 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.130 1998/12/06 00:03:30 archie Exp $ + * $Id: trap.c,v 1.131 1998/12/16 15:21:50 bde Exp $ */ /* @@ -93,6 +93,10 @@ #include <machine/vm86.h> #endif +#ifdef DDB + extern int in_Debugger, debugger_on_panic; +#endif + #include "isa.h" #include "npx.h" @@ -901,7 +905,7 @@ trap_fatal(frame, eva) 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); |