How to produce debugging symbols?

Dan Nelson dnelson at
Wed Mar 26 22:25:57 PST 2003

In the last episode (Mar 26), taxman said:
> On Wednesday 26 March 2003 03:11 pm, Dan Nelson wrote:
> > If it's your program, recompile and link with the -g commandline
> > switch added.  If it's a base FreeBSD program (or port), edit the
> > Makefile and add a line reading "DEBUG_FLAGS=-g" (this will compile
> > with -g and also no strip the debugging symbols when the binary
> > gets installed).
> Does this work for the kernel?  I'd read that the kernel strips
> symbols anyway.  If i put makeoptions DEBUG=-g in my kernel config
> (as shown in LINT) will I still get the symbols?  Thats for 4.x, what
> about 5.0 is that different?

It still works in 5.0.  What ends up happenning is a debugging kernel
gets built as kernel.debug, but the stripped version is still installed
into /boot/kernel/ (most likely to conserve space on /).  When you
panic and coredump, copy kernel.debug out of the source tree into
/var/crash and use that to debug.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list