diff options
author | Conrad Meyer <cem@FreeBSD.org> | 2018-04-24 18:54:20 +0000 |
---|---|---|
committer | Conrad Meyer <cem@FreeBSD.org> | 2018-04-24 18:54:20 +0000 |
commit | ad1fc31570cd520b712ef5063bf6bcba525d498b (patch) | |
tree | c6088987da99c8731d3dbd2660013a590a7df86a /sys/kern/kern_shutdown.c | |
parent | 18959b695d55d5c034556d69737a5dd14f866f0d (diff) | |
download | src-ad1fc31570cd520b712ef5063bf6bcba525d498b.tar.gz src-ad1fc31570cd520b712ef5063bf6bcba525d498b.zip |
panic: Optionally, trace secondary panics
To diagnose and fix secondary panics, it is useful to have a stack trace.
When panic tracing is enabled, optionally trace secondary panics as well.
The option is configured with the tunable/sysctl debug.trace_all_panics.
(The original concern that inspired only tracing the primary panic was
likely that the secondary trace may scroll the original panic message or trace
off the screen. This is less of a concern for serial consoles with logging.
Not everything has a serial console, though, so the behavior is optional.)
Discussed with: jhb
Sponsored by: Dell EMC Isilon
Notes
Notes:
svn path=/head/; revision=332959
Diffstat (limited to 'sys/kern/kern_shutdown.c')
-rw-r--r-- | sys/kern/kern_shutdown.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 6d9a91c9b728..f0a459fbdfae 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -124,12 +124,16 @@ SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, #ifdef KDB_TRACE static int trace_on_panic = 1; +static bool trace_all_panics = true; #else static int trace_on_panic = 0; +static bool trace_all_panics = false; #endif SYSCTL_INT(_debug, OID_AUTO, trace_on_panic, CTLFLAG_RWTUN | CTLFLAG_SECURE, &trace_on_panic, 0, "Print stack trace on kernel panic"); +SYSCTL_BOOL(_debug, OID_AUTO, trace_all_panics, CTLFLAG_RWTUN, + &trace_all_panics, 0, "Print stack traces on secondary kernel panics"); #endif /* KDB */ static int sync_on_panic = 0; @@ -829,7 +833,7 @@ vpanic(const char *fmt, va_list ap) #endif printf("time = %jd\n", (intmax_t )time_second); #ifdef KDB - if (newpanic && trace_on_panic) + if ((newpanic || trace_all_panics) && trace_on_panic) kdb_backtrace(); if (debugger_on_panic) kdb_enter(KDB_WHY_PANIC, "panic"); |