Add "show panic" that shows the current panic string. two ports had it, and

it could be easily made MI.
This commit is contained in:
christos 2013-01-05 15:23:27 +00:00
parent bd1c8509d7
commit cedbce7adf
3 changed files with 22 additions and 5 deletions

View File

@ -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_cmds[] = {
"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,

View File

@ -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, bool, db_expr_t, const char *,
/* 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 *);

View File

@ -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 haddr,
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
}