How to get better debugging for the kernel.

Edward Tomasz Napierała trasz at FreeBSD.org
Thu Aug 4 07:58:23 UTC 2016


On 0802T1735, 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 _and_ how
> badly will that affect the runtime of a lightly loaded server?
> 
> 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?

You can try putting "#pragma clang optimize off" at the top of the file.



More information about the freebsd-hackers mailing list