Source-Changes-HG archive

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

[src/trunk]: src/sys/ddb Add "show panic" that shows the current panic string...



details:   https://anonhg.NetBSD.org/src/rev/d6d8b274e1f6
branches:  trunk
changeset: 783709:d6d8b274e1f6
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 05 15:23:27 2013 +0000

description:
Add "show panic" that shows the current panic string. two ports had it, and
it could be easily made MI.

diffstat:

 sys/ddb/db_command.c   |   6 ++++--
 sys/ddb/db_interface.h |   3 ++-
 sys/ddb/db_xxx.c       |  18 ++++++++++++++++--
 3 files changed, 22 insertions(+), 5 deletions(-)

diffs (80 lines):

diff -r 81965bcc4073 -r d6d8b274e1f6 sys/ddb/db_command.c
--- a/sys/ddb/db_command.c      Sat Jan 05 15:06:51 2013 +0000
+++ b/sys/ddb/db_command.c      Sat Jan 05 15:23:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_command.c,v 1.138 2012/04/28 23:03:39 rmind Exp $   */
+/*     $NetBSD: db_command.c,v 1.139 2013/01/05 15:23:27 christos Exp $        */
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.138 2012/04/28 23:03:39 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.139 2013/01/05 15:23:27 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -264,6 +264,8 @@
            "Print the vm_object at address.", "[/f] address",NULL) },
        { DDB_ADD_CMD("page",   db_page_print_cmd,      0,
            "Print the vm_page at address.", "[/f] address",NULL) },
+       { DDB_ADD_CMD("panic",  db_show_panic,  0,
+           "Print the current panic string",NULL,NULL) },
        { DDB_ADD_CMD("pool",   db_pool_print_cmd,      0,
            "Print the pool at address.", "[/clp] address",NULL) },
        { DDB_ADD_CMD("registers",      db_show_regs,           0,
diff -r 81965bcc4073 -r d6d8b274e1f6 sys/ddb/db_interface.h
--- a/sys/ddb/db_interface.h    Sat Jan 05 15:06:51 2013 +0000
+++ b/sys/ddb/db_interface.h    Sat Jan 05 15:23:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.h,v 1.28 2012/02/10 02:14:23 christos Exp $       */
+/*     $NetBSD: db_interface.h,v 1.29 2013/01/05 15:23:27 christos Exp $       */
 
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
@@ -43,6 +43,7 @@
 /* ddb/db_xxx.c */
 void           db_kgdb_cmd(db_expr_t, bool, db_expr_t, const char *);
 void           db_show_files_cmd(db_expr_t, bool, db_expr_t, const char *);
+void           db_show_panic(db_expr_t, bool, db_expr_t, const char *);
 
 /* kern/kern_proc.c */
 void           db_kill_proc(db_expr_t, bool, db_expr_t, const char *);
diff -r 81965bcc4073 -r d6d8b274e1f6 sys/ddb/db_xxx.c
--- a/sys/ddb/db_xxx.c  Sat Jan 05 15:06:51 2013 +0000
+++ b/sys/ddb/db_xxx.c  Sat Jan 05 15:23:27 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_xxx.c,v 1.66 2011/12/03 16:25:49 christos Exp $     */
+/*     $NetBSD: db_xxx.c,v 1.67 2013/01/05 15:23:27 christos Exp $     */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.66 2011/12/03 16:25:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.67 2013/01/05 15:23:27 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kgdb.h"
@@ -306,3 +306,17 @@
        sched_print_runqueue(db_printf);
 #endif
 }
+
+void
+db_show_panic(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
+{
+#ifdef _KERNEL /* XXX CRASH(8) */
+        int s;
+
+       s = splhigh();
+
+       db_printf("Panic string: %s\n", panicstr);
+
+       (void)splx(s);
+#endif
+}



Home | Main Index | Thread Index | Old Index