Module Name:    src
Committed By:   christos
Date:           Sat Jan  5 15:23:27 UTC 2013

Modified Files:
        src/sys/ddb: db_command.c db_interface.h db_xxx.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/ddb/db_command.c
cvs rdiff -u -r1.28 -r1.29 src/sys/ddb/db_interface.h
cvs rdiff -u -r1.66 -r1.67 src/sys/ddb/db_xxx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.138 src/sys/ddb/db_command.c:1.139
--- src/sys/ddb/db_command.c:1.138	Sat Apr 28 19:03:39 2012
+++ src/sys/ddb/db_command.c	Sat Jan  5 10:23:27 2013
@@ -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 @@ static const struct db_command db_show_c
 	    "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,

Index: src/sys/ddb/db_interface.h
diff -u src/sys/ddb/db_interface.h:1.28 src/sys/ddb/db_interface.h:1.29
--- src/sys/ddb/db_interface.h:1.28	Thu Feb  9 21:14:23 2012
+++ src/sys/ddb/db_interface.h	Sat Jan  5 10:23:27 2013
@@ -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 @@ void		db_stack_trace_print(db_expr_t, bo
 /* 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 *);

Index: src/sys/ddb/db_xxx.c
diff -u src/sys/ddb/db_xxx.c:1.66 src/sys/ddb/db_xxx.c:1.67
--- src/sys/ddb/db_xxx.c:1.66	Sat Dec  3 11:25:49 2011
+++ src/sys/ddb/db_xxx.c	Sat Jan  5 10:23:27 2013
@@ -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 @@ db_show_sched_qs(db_expr_t addr, bool ha
 	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
+}

Reply via email to