Date: Thu, 7 Dec 2023 10:17:14 +0800 From: Zhenlei Huang <zlei@FreeBSD.org> To: Farhan Khan <farhan@farhan.codes> Cc: freebsd-hackers@freebsd.org Subject: Re: Build src tree in Develop/Debug mode Message-ID: <847F2A9D-AE5F-4BFC-85CD-51900A9218EA@FreeBSD.org> In-Reply-To: <1fc31593-a274-4dc7-a4a5-ec2af0cb392a@app.fastmail.com> References: <1fc31593-a274-4dc7-a4a5-ec2af0cb392a@app.fastmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On Dec 7, 2023, at 1:09 AM, Farhan Khan <farhan@farhan.codes> wrote: >=20 > Hi all, >=20 > Is there a build-in-debug-mode flag I can run when building the kernel = (or world)? >=20 > 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+=3D-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. >=20 > 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. There's an option COPTFLAGS. You can try=20 ``` $ setenv COPTFLAGS -O0 $ make buildkernel KERNCONF=3DGENERIC ``` >=20 > I briefly wrote about this a few years back: = https://blog.farhan.codes/2018/08/16/including-optimized-out-kernel-symbol= s-in-dtrace-on-freebsd/ >=20 > Thanks! > -- > Farhan Khan > PGP Fingerprint: 1312 89CE 663E 1EB2 179C 1C83 C41D 2281 F8DA C0DE >=20 >=20 Best regards, Zhenlei
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?847F2A9D-AE5F-4BFC-85CD-51900A9218EA>