General debug/kernel question

Robert Watson rwatson at
Sun Nov 16 18:32:52 PST 2003

On Mon, 17 Nov 2003, Harald Schmalzbauer wrote:

> I always thought that building a kernel with debug symbols would
> increase the kernel size dramatically. But if I understand things right
> the additioal "symbols" (code snippets?) are not in the kernel but in a
> different file which makes the kernel the same size like without
> debug=-g. Is there any reason to not build it with debug=-g?  Also I
> thought debug kernels suffer from reduced performance. I also have DDB
> in my kernel and don't _feel_ any difference. So again, is there any
> reason not to put DDB into the kernel? 

The kernel installed in /boot is stripped of debugging symbols during
installkernel, which helps with the space problem -- du kernel.debug
sometime, and you'll see why this is particularly necessary :-).  DDB
relies on the linking symbols presenting in the kernel for module loading
to generate stack traces.  The full debugging kernel is used for offline
debugging of core dumps, serial debugging, etc with gdb.  The usual reason
not to put DDB in a kernel is that the user doesn't know what to do with
it, or because it causes panics to halt as opposed to reboot.  The
DDB_UNATTENDED option can help with that though.  Another thing to keep in
mind is that if you're using X11 on the console, it prevent you from
seeing DDB output unless you're using a serial console, so X11 will simply
appear to hang...

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at      Network Associates Laboratories

More information about the freebsd-current mailing list