How to get better debugging for the kernel.

Andriy Gapon avg at FreeBSD.org
Wed Aug 3 06:25:37 UTC 2016


On 03/08/2016 00:35, Zaphod Beeblebrox wrote:
> I have just filed bug 211535.  I'd like to be more helpful, but I'm having
> some trouble with the level of optimization in the kernel.  Much of kgdb's
> output tells me that the value I'm looking for has been optimized away.
> 
> So... how do I compile a kernel or a module without optimization

I have this in my kernel configuration:
makeoptions     CONF_CFLAGS="-O1"

Also I have to use amd64-gcc to build the kernel because of a problem
that happens when using clang to compile amd64 kernel modules
(particularly zfs) at that optimization level.
It's as simple as:
- pkg install amd64-xtoolchain-gcc
- add CROSS_TOOLCHAIN=amd64-gcc to the buildkernel invocation

> _and_ how
> badly will that affect the runtime of a lightly loaded server?

I think that nobody would be able to tell you that in advance.
But I expect that you won't see any difference.
Why don't you try and report back? :-)

> My kernel is already compiled with -g.  That tells me that I'm looking in
> zap_leaf.c (part of ZFS).  Can I simply compile zap_leaf.c without
> optimization?


-- 
Andriy Gapon


More information about the freebsd-hackers mailing list