Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Dec 2023 12:09:59 -0500
From:      "Farhan Khan" <farhan@farhan.codes>
To:        freebsd-hackers@freebsd.org
Subject:   Build src tree in Develop/Debug mode
Message-ID:  <1fc31593-a274-4dc7-a4a5-ec2af0cb392a@app.fastmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,

Is there a build-in-debug-mode flag I can run when building the kernel (or world)?

I was tinkering through the build system and saw that the optimization is hardcoded to -O2 and objcopy strips debugging symbols. This means even with "CFLAGS+=-g -O0 -fno-inline-functions" in my /etc/make.conf I am still losing symbols and sometimes getting unwanted optimizations. The result is that `kgdb` often does not know what line a crash took place in.

Is there an option to disable all optimizations, optimizations and symbol stripping? If not, IMO, this would be a good candidate for an option to add.

I briefly wrote about this a few years back: https://blog.farhan.codes/2018/08/16/including-optimized-out-kernel-symbols-in-dtrace-on-freebsd/

Thanks!
--
Farhan Khan
PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1fc31593-a274-4dc7-a4a5-ec2af0cb392a>