aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-11-19 18:03:40 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-11-19 18:03:40 +0000
commitc8a96cdcd9662bdda3686075000b6b541de3bbcc (patch)
tree722f4c02fd6fbbf4f8b889e87c4bf3cb38a23a91
parent24d79e9b638a1fcd1b4c2568dededb6dbd66872f (diff)
Notes
-rw-r--r--share/man/man4/ddb.412
-rw-r--r--sys/kern/kern_shutdown.c7
2 files changed, 18 insertions, 1 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
index c4ea9f9cf92aa..5dab5c42a2ce4 100644
--- a/share/man/man4/ddb.4
+++ b/share/man/man4/ddb.4
@@ -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 .
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index f2112aea19408..e200b6d8a4b43 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -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;