Date: Fri, 10 Jun 2005 23:32:54 +0200 From: Antoine Brodin <antoine.brodin@laposte.net> To: "Poul-Henning Kamp" <phk@phk.freebsd.dk> Cc: freebsd-arch@freebsd.org Subject: Re: RFC: Stack saving/tracing functionality. Message-ID: <20050610233254.44880290.antoine.brodin@laposte.net> In-Reply-To: <9261.1118346707@critter.freebsd.dk> References: <20050608221829.75c2de12.antoine.brodin@laposte.net> <9261.1118346707@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
"Poul-Henning Kamp" <phk@phk.freebsd.dk> wrote: > In message <20050608221829.75c2de12.antoine.brodin@laposte.net>, Antoine Brodin writes: > >Hi, > > > > > >With Jeff@'s help, I implemented stack saving/tracing functionality. > > Thankyou! > > >Another question: Since the stack saving/tracing functionality depends > >on ddb, should kern/subr_stack.c be moved to ddb/stack.c and > >sys/stack.h to ddb/stack.h? > > No. > > This code should be compiled in as standard so that any panic prints > a stacktrace on the console, also for non-KDB kernels. I put the MD code in <arch>/<arch>/db_trace.c to avoid the duplication of some structure declarations like i386_frame, or the definition of the INKERNEL macro. Should I move these to something like <arch>/include/frame.h and put stack_save in its own file (this function is around 20 lines per arch) ? > A sysctl to enable grepping a backtrace from core-dumping processes > would be wonderful as well. It isn't possible to backtrace processes while they're in userland yet, and I'm not sure it would be safe (one could corrupt its own stack to try to confuse the kernel) and useful (gdb handles core dumps very well). But you can grab the end of life of the process in the kernel like: %%% #0 0xc04d712c at sigexit+0xfc #1 0xc04d6d9c at postsig+0x19c #2 0xc04f8fc8 at ast+0x4d8 #3 0xc061726d at doreti_ast+0x17 %%% I don't know if this is what you were looking for ? An updated patch with a correction in the alpha case is at: http://bsd.miki.eu.org/~antoine/stack/stack-06-10.diff Cheers, Antoine
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050610233254.44880290.antoine.brodin>