diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 41434c4206d9..405cbc28e845 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -387,6 +387,16 @@ options DIAGNOSTIC # options REGRESSION +# +# RESTARTABLE_PANICS allows one to continue from a panic as if it were +# a call to the debugger via the Debugger() function instead. It is only +# useful if a kernel debugger is present. To restart from a panic, reset +# the panicstr variable to NULL and continue execution. This option is +# for development use only and should NOT be used in production systems +# to "workaround" a panic. +# +options RESTARTABLE_PANICS + # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. diff --git a/sys/conf/options b/sys/conf/options index 6e62f52c87cd..f43d3d664c7c 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -387,6 +387,7 @@ ENABLE_VFS_IOOPT opt_global.h INVARIANT_SUPPORT opt_global.h INVARIANTS opt_global.h REGRESSION opt_global.h +RESTARTABLE_PANICS opt_global.h SIMPLELOCK_DEBUG opt_global.h VFS_BIO_DEBUG opt_global.h diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 41434c4206d9..405cbc28e845 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -387,6 +387,16 @@ options DIAGNOSTIC # options REGRESSION +# +# RESTARTABLE_PANICS allows one to continue from a panic as if it were +# a call to the debugger via the Debugger() function instead. It is only +# useful if a kernel debugger is present. To restart from a panic, reset +# the panicstr variable to NULL and continue execution. This option is +# for development use only and should NOT be used in production systems +# to "workaround" a panic. +# +options RESTARTABLE_PANICS + # # PERFMON causes the driver for Pentium/Pentium Pro performance counters # to be compiled. See perfmon(4) for more information. diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 3b83723cc633..1afa80fb0077 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -610,6 +610,7 @@ panic(const char *fmt, ...) #if defined(DDB) if (debugger_on_panic) Debugger ("panic"); +#ifdef RESTARTABLE_PANICS /* See if the user aborted the panic, in which case we continue. */ if (panicstr == NULL) { #ifdef SMP @@ -617,6 +618,7 @@ panic(const char *fmt, ...) #endif return; } +#endif #endif boot(bootopt); } diff --git a/sys/sys/param.h b/sys/sys/param.h index 984735f70bfb..59da5f0dc6f6 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -236,6 +236,10 @@ * things that included sys/systm.h just for panic(). */ #ifdef _KERNEL +#ifdef RESTARTABLE_PANICS +void panic __P((const char *, ...)) __printflike(1, 2); +#else void panic __P((const char *, ...)) __dead2 __printflike(1, 2); #endif +#endif #endif /* _SYS_PARAM_H_ */