Date: Mon, 6 Jun 2016 18:42:22 -0700 From: Ngie Cooper <yaneurabeya@gmail.com> To: "Bjoern A. Zeeb" <bz@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r301522 - in head: share/man/man4 sys/kern Message-ID: <379A4F79-F631-4696-8C09-0822610C04D4@gmail.com> In-Reply-To: <201606062057.u56KvOMU015125@repo.freebsd.org> References: <201606062057.u56KvOMU015125@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Jun 6, 2016, at 13:57, Bjoern A. Zeeb <bz@FreeBSD.org> wrote: >=20 > Author: bz > Date: Mon Jun 6 20:57:24 2016 > New Revision: 301522 > URL: https://svnweb.freebsd.org/changeset/base/301522 Awesome -- thanks bz!!! > Log: > Implement a `show panic` command to DDB which will helpfully print the > panic string again if set, in case it scrolled out of the active > window. This avoids having to remember the symbol name. >=20 > Also add a show callout <addr> command to DDB in order to inspect > some struct callout fields in case of panics in the callout code. > This may help to see if there was memory corruption or to further > ease debugging problems. >=20 > Obtained from: projects/vnet > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Reviewed by: jhb (comment only on the show panic initally) > Differential Revision: https://reviews.freebsd.org/D4527 >=20 > Modified: > head/share/man/man4/ddb.4 > head/sys/kern/kern_shutdown.c > head/sys/kern/kern_timeout.c >=20 > Modified: head/share/man/man4/ddb.4 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/share/man/man4/ddb.4 Mon Jun 6 20:42:54 2016 (r301521) > +++ head/share/man/man4/ddb.4 Mon Jun 6 20:57:24 2016 (r301522) > @@ -60,7 +60,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd May 18, 2016 > +.Dd June 6, 2016 > .Dt DDB 4 > .Os > .Sh NAME > @@ -599,6 +599,13 @@ See the > 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 @@ option is specified the > 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. > .\" >=20 > Modified: head/sys/kern/kern_shutdown.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/sys/kern/kern_shutdown.c Mon Jun 6 20:42:54 2016 (r301521)= > +++ head/sys/kern/kern_shutdown.c Mon Jun 6 20:57:24 2016 (r301522)= > @@ -929,3 +929,14 @@ mkdumpheader(struct kerneldumpheader *kd > strlcpy(kdh->panicstring, panicstr, sizeof(kdh->panicstring)); > kdh->parity =3D kerneldump_parity(kdh); > } > + > +#ifdef DDB > +DB_SHOW_COMMAND(panic, db_show_panic) > +{ > + > + if (panicstr =3D=3D NULL) > + db_printf("panicstr not set\n"); > + else > + db_printf("panic: %s\n", panicstr); > +} > +#endif >=20 > Modified: head/sys/kern/kern_timeout.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D > --- head/sys/kern/kern_timeout.c Mon Jun 6 20:42:54 2016 (r301521) > +++ head/sys/kern/kern_timeout.c Mon Jun 6 20:57:24 2016 (r301522) > @@ -38,6 +38,7 @@ > __FBSDID("$FreeBSD$"); >=20 > #include "opt_callout_profiling.h" > +#include "opt_ddb.h" > #if defined(__arm__) > #include "opt_timer.h" > #endif > @@ -60,6 +61,11 @@ __FBSDID("$FreeBSD$"); > #include <sys/sysctl.h> > #include <sys/smp.h> >=20 > +#ifdef DDB > +#include <ddb/ddb.h> > +#include <machine/_inttypes.h> > +#endif > + > #ifdef SMP > #include <machine/cpu.h> > #endif > @@ -1615,3 +1621,34 @@ SYSCTL_PROC(_kern, OID_AUTO, callout_sta > 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 =3D " f "\n", #e, c->e);= > + db_printf(" &c_links =3D %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 <struct callout *>\n"); > + return; > + } > + > + _show_callout((struct callout *)addr); > +} > +#endif /* DDB */ >=20
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?379A4F79-F631-4696-8C09-0822610C04D4>