Index: head/share/man/man4/ddb.4 =================================================================== --- head/share/man/man4/ddb.4 +++ head/share/man/man4/ddb.4 @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2016 +.Dd June 6, 2016 .Dt DDB 4 .Os .Sh NAME @@ -599,6 +599,13 @@ header file for more details on the exact meaning of the structure fields. .\" .Pp +.It Ic show Cm callout Ar addr +Show information about the callout structure +.Vt struct callout +present at +.Ar addr . +.\" +.Pp .It Ic show Cm cbstat Show brief information about the TTY subsystem. .\" @@ -834,6 +841,10 @@ complete object is printed. .\" .Pp +.It Ic show Cm panic +Print the panic message if set. +.\" +.Pp .It Ic show Cm page Show statistics on VM pages. .\" Index: head/sys/kern/kern_shutdown.c =================================================================== --- head/sys/kern/kern_shutdown.c +++ head/sys/kern/kern_shutdown.c @@ -929,3 +929,14 @@ strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); kdh->parity = kerneldump_parity(kdh); } + +#ifdef DDB +DB_SHOW_COMMAND(panic, db_show_panic) +{ + + if (panicstr == NULL) + db_printf("panicstr not set\n"); + else + db_printf("panic: %s\n", panicstr); +} +#endif Index: head/sys/kern/kern_timeout.c =================================================================== --- head/sys/kern/kern_timeout.c +++ head/sys/kern/kern_timeout.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_callout_profiling.h" +#include "opt_ddb.h" #if defined(__arm__) #include "opt_timer.h" #endif @@ -60,6 +61,11 @@ #include #include +#ifdef DDB +#include +#include +#endif + #ifdef SMP #include #endif @@ -1615,3 +1621,34 @@ CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_callout_stat, "I", "Dump immediate statistic snapshot of the scheduled callouts"); + +#ifdef DDB +static void +_show_callout(struct callout *c) +{ + + db_printf("callout %p\n", c); +#define C_DB_PRINTF(f, e) db_printf(" %s = " f "\n", #e, c->e); + db_printf(" &c_links = %p\n", &(c->c_links)); + C_DB_PRINTF("%" PRId64, c_time); + C_DB_PRINTF("%" PRId64, c_precision); + C_DB_PRINTF("%p", c_arg); + C_DB_PRINTF("%p", c_func); + C_DB_PRINTF("%p", c_lock); + C_DB_PRINTF("%#x", c_flags); + C_DB_PRINTF("%#x", c_iflags); + C_DB_PRINTF("%d", c_cpu); +#undef C_DB_PRINTF +} + +DB_SHOW_COMMAND(callout, db_show_callout) +{ + + if (!have_addr) { + db_printf("usage: show callout \n"); + return; + } + + _show_callout((struct callout *)addr); +} +#endif /* DDB */