Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src If db_onpanic is unset and DDB is compiled in, panic() now c...



details:   https://anonhg.NetBSD.org/src/rev/0feb7b217a5d
branches:  trunk
changeset: 486608:0feb7b217a5d
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Fri May 26 20:25:57 2000 +0000

description:
If db_onpanic is unset and DDB is compiled in, panic() now calls
db_stack_trace_print(__builtin_frame_address(0),...), to printf() the
stack trace to the message bufffer and console. Idea from SunOS/Solaris.
Useful when dumping fails.

diffstat:

 share/man/man9/panic.9 |  30 ++++++++++++++++++++++++------
 sys/kern/subr_prf.c    |  11 ++++++++++-
 2 files changed, 34 insertions(+), 7 deletions(-)

diffs (90 lines):

diff -r ce48d3a2cd97 -r 0feb7b217a5d share/man/man9/panic.9
--- a/share/man/man9/panic.9    Fri May 26 20:18:57 2000 +0000
+++ b/share/man/man9/panic.9    Fri May 26 20:25:57 2000 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: panic.9,v 1.7 1999/03/06 22:09:29 mycroft Exp $
+.\"     $NetBSD: panic.9,v 1.8 2000/05/26 20:25:57 jhawk Exp $
 .\"
 .\" Copyright (c) 1996 Michael Graff.
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 11, 1995
+.Dd May 26, 2000
 .Dt PANIC 9
 .Os
 .Sh NAME
@@ -53,11 +53,25 @@
 style format string which is printed to the console and saved in the
 variable
 .Va panicstr 
-for later retrival via core dump inspection.
+for later retrieval via core dump inspection.
 .Pp
 If a kernel debugger is installed, control is passed to it after the
-message is printed.
-Otherwise an attempt is made to save an image of system memory on the
+message is printed. If the kernel debugger is
+.Xr ddb 4 ,
+control is only passed if the value of the
+.Em ddb.onpanic
+.Xr sysctl 3
+is
+.Dq 1 ,
+otherwise, a
+.Xr ddb 4 -specific
+function is used to print the kernel stack trace, and then control returns
+to
+.Fn panic .
+.Pp
+If control remains in
+.Fn panic ,
+an attempt is made to save an image of system memory on the
 dump device that was configured at the time the kernel was compiled.
 .Pp
 If during the process of handling the panic,
@@ -70,5 +84,9 @@
 .Fn panic
 function does not return.
 .Sh SEE ALSO
+.Xr sysctl 3 ,
+.Xr ddb 4 ,
+.Xr ipkdb 4 ,
 .Xr options 4 ,
-.Xr savecore 8
+.Xr savecore 8 ,
+.Xr sysctl 8
diff -r ce48d3a2cd97 -r 0feb7b217a5d sys/kern/subr_prf.c
--- a/sys/kern/subr_prf.c       Fri May 26 20:18:57 2000 +0000
+++ b/sys/kern/subr_prf.c       Fri May 26 20:25:57 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_prf.c,v 1.71 2000/05/25 21:32:41 jhawk Exp $      */
+/*     $NetBSD: subr_prf.c,v 1.72 2000/05/26 20:25:57 jhawk Exp $      */
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -63,6 +63,9 @@
 
 #ifdef DDB
 #include <ddb/ddbvar.h>
+#include <machine/db_machdep.h>
+#include <ddb/db_command.h>
+#include <ddb/db_interface.h>
 #endif
 
 #ifdef IPKDB
@@ -214,6 +217,12 @@
 #ifdef DDB
        if (db_onpanic)
                Debugger();
+       else {
+               printf("Begin traceback...\n");
+               db_stack_trace_print((db_expr_t)__builtin_frame_address(0),
+                   TRUE, 65535, "", printf);
+               printf("End traceback...\n");
+       }
 #endif
        cpu_reboot(bootopt, NULL);
 }



Home | Main Index | Thread Index | Old Index