Date: Sat, 18 Sep 2010 22:35:48 +0200 From: Attilio Rao <attilio@freebsd.org> To: Andriy Gapon <avg@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: KDB_TRACE and no backend Message-ID: <AANLkTimuiBG4nL4o%2BJ%2BKM6%2B9QdkRwwEsWnbC-tsoNO54@mail.gmail.com> In-Reply-To: <4C95214A.3070600@freebsd.org> References: <4C94A138.8050905@icyb.net.ua> <AANLkTingR6k6xdQJ3cZH8EkJeCWnq5vzeEjGHNaDv8AT@mail.gmail.com> <4C9507D1.3010008@icyb.net.ua> <4C950C48.6020600@freebsd.org> <4C95214A.3070600@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
2010/9/18 Andriy Gapon <avg@freebsd.org>: > on 18/09/2010 22:00 Andriy Gapon said the following: >> Oh, wow, and I totally overlooked stack_print(). >> Should have read stack(9) from the start. > > New patch. =C2=A0Hope this is better. > I don't like that the printf is duplicated, but couldn't figure out a way= to > combine pre-processor and C conditions. > > --- a/sys/kern/subr_kdb.c > +++ b/sys/kern/subr_kdb.c > @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); > =C2=A0#include <sys/pcpu.h> > =C2=A0#include <sys/proc.h> > =C2=A0#include <sys/smp.h> > +#include <sys/stack.h> > =C2=A0#include <sys/sysctl.h> > > =C2=A0#include <machine/kdb.h> > @@ -300,6 +301,15 @@ kdb_backtrace(void) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("KDB: stack= backtrace:\n"); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kdb_dbbe->dbbe_tra= ce(); > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > +#ifdef STACK > + =C2=A0 =C2=A0 =C2=A0 else { > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct stack st; > + > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printf("KDB: stack bac= ktrace:\n"); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stack_save(&st); > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 stack_print(&st); > + =C2=A0 =C2=A0 =C2=A0 } > +#endif > =C2=A0} > > =C2=A0/* > It is still missing checking on opt_stack.h Besides, I'd reconsider having KDB_TRACE explanation in ddb(4) manpage (right now it is rightly there because it is DDB specific only, as long as it offers the backend, but with your change it is a global functionality. Not sure if it worths changing it but however you may have more opinions). Thanks, Attilio --=20 Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimuiBG4nL4o%2BJ%2BKM6%2B9QdkRwwEsWnbC-tsoNO54>