Add an option for entering KDB on recursive panics
There are many cases where one would choose avoid entering the debugger on a normal panic, opting instead to reboot and possibly save a kernel dump. However, recursive kernel panics are an unusual case that might warrant attention from a human, so provide a secondary tunable, debug.debugger_on_recursive_panic, to allow entering the debugger only when this occurs. For for simplicity in maintaining existing behaviour, the tunable defaults to zero. Reviewed by: cem, markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27271
This commit is contained in:
parent
24d79e9b63
commit
c8a96cdcd9
@ -26,7 +26,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd October 17, 2019
|
||||
.Dd November 19, 2020
|
||||
.Dt DDB 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -87,6 +87,16 @@ which is the default
|
||||
unless the
|
||||
.Dv KDB_UNATTENDED
|
||||
option is specified.
|
||||
Similarly, if the
|
||||
.Va debug.debugger_on_recursive_panic
|
||||
variable is set to
|
||||
.Dv 1 ,
|
||||
then the debugger will be invoked on a recursive kernel panic.
|
||||
This variable has a default value of
|
||||
.Dv 0 ,
|
||||
and has no effect if
|
||||
.Va debug.debugger_on_panic
|
||||
is already set non-zero.
|
||||
.Pp
|
||||
The current location is called
|
||||
.Va dot .
|
||||
|
@ -127,6 +127,11 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic,
|
||||
CTLFLAG_RWTUN | CTLFLAG_SECURE,
|
||||
&debugger_on_panic, 0, "Run debugger on kernel panic");
|
||||
|
||||
static bool debugger_on_recursive_panic = false;
|
||||
SYSCTL_BOOL(_debug, OID_AUTO, debugger_on_recursive_panic,
|
||||
CTLFLAG_RWTUN | CTLFLAG_SECURE,
|
||||
&debugger_on_recursive_panic, 0, "Run debugger on recursive kernel panic");
|
||||
|
||||
int debugger_on_trap = 0;
|
||||
SYSCTL_INT(_debug, OID_AUTO, debugger_on_trap,
|
||||
CTLFLAG_RWTUN | CTLFLAG_SECURE,
|
||||
@ -899,6 +904,8 @@ vpanic(const char *fmt, va_list ap)
|
||||
kdb_backtrace();
|
||||
if (debugger_on_panic)
|
||||
kdb_enter(KDB_WHY_PANIC, "panic");
|
||||
else if (!newpanic && debugger_on_recursive_panic)
|
||||
kdb_enter(KDB_WHY_PANIC, "re-panic");
|
||||
#endif
|
||||
/*thread_lock(td); */
|
||||
td->td_flags |= TDF_INPANIC;
|
||||
|
Loading…
Reference in New Issue
Block a user