Date: Mon, 18 May 2015 17:29:50 -0700 From: NGie Cooper <yaneurabeya@gmail.com> To: Alexander Kabaev <kabaev@gmail.com> Cc: Sean Bruno <sbruno@ignoranthack.me>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: How to get anything useful out of kgdb? Message-ID: <CAGHfRMC10JJs7f9yzmNpeHNN8sM9ZFci1gpvqwqhvcGSQS4RXA@mail.gmail.com> In-Reply-To: <CAGHfRMAGTF0oh%2BR0kDxyx7PWSPfcTyZT-cMogF_LrV5pR2J4-w@mail.gmail.com> References: <554E41EE.2010202@ignoranthack.me> <554E4BD1.1030802@ignoranthack.me> <406EAA27-D825-408B-985E-DC3FFE746473@frob.org> <554E5263.8010205@ignoranthack.me> <20150509190347.10e1e2c2@kan> <CAGHfRMAGTF0oh%2BR0kDxyx7PWSPfcTyZT-cMogF_LrV5pR2J4-w@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 18, 2015 at 3:44 PM, NGie Cooper <yaneurabeya@gmail.com> wrote: ... > This isn't working as advertised. > > While trying to track down issues with clang at $work with variables > that were optimized out, I noticed that it was passing through -O2 > explicitly, even though DEBUG=-g was defined in our KERNCONF, which is > supposed to set _MINUS_O to -O. > > I did some more poking around and it appears to always be the case > with 11-CURRENT as well (see below). > > I'll post a diff for kern.pre.mk that fixes this on Phabricator soon, > because this is breaking our debuggability of clang kernels. > > Thanks, > -NGie > > $ git diff sys/conf/kern.pre.mk > diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk > index 8c3b9c6..2ab0647 100644 > --- a/sys/conf/kern.pre.mk > +++ b/sys/conf/kern.pre.mk > @@ -102,6 +102,8 @@ CFLAGS.gcc+=${CFLAGS_ARCH_PARAMS} > .endif > WERROR?= -Werror > > +.error "CFLAGS: ${CFLAGS}" > + > # XXX LOCORE means "don't declare C stuff" not "for locore.s". > ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} ${ASM_CFLAGS.${.IMPSRC:T}} > > $ script ts make buildkernel KERNCONF=GENERIC > KERNCONFDIR=/sys/amd64/conf/ SRCCONF=/dev/null __MAKE_CONF=/dev/null > -j12 > Script started, output file is ts > --- buildkernel --- > --- buildkernel --- > -------------------------------------------------------------- >>>> Kernel build for GENERIC started on Mon May 18 15:38:04 PDT 2015 > -------------------------------------------------------------- > ===> GENERIC > mkdir -p /usr/obj/usr/src/sys > -------------------------------------------------------------- >>>> stage 1: configuring the kernel > -------------------------------------------------------------- > cd /usr/src/sys/amd64/conf; > PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/bin:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin > config -d /usr/obj/usr/src/sys/GENERIC -I '/sys/amd64/conf/' > '/sys/amd64/conf//GENERIC' > Kernel build directory is /usr/obj/usr/src/sys/GENERIC > Don't forget to do ``make cleandepend && make depend'' > -------------------------------------------------------------- >>>> stage 2.1: cleaning up the object tree > -------------------------------------------------------------- > cd /usr/obj/usr/src/sys/GENERIC; MAKEOBJDIRPREFIX=/usr/obj > MACHINE_ARCH=amd64 MACHINE=amd64 CPUTYPE= > GROFF_BIN_PATH=/usr/obj/usr/src/tmp/legacy/usr/bin > GROFF_FONT_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/groff_font > GROFF_TMAC_PATH=/usr/obj/usr/src/tmp/legacy/usr/share/tmac > _SHLIBDIRPREFIX=/usr/obj/usr/src/tmp _LDSCRIPTROOT= VERSION="FreeBSD > 11.0-CURRENT amd64 1100073" INSTALL="sh /usr/src/tools/install.sh" > PATH=/usr/obj/usr/src/tmp/legacy/usr/sbin:/usr/obj/usr/src/tmp/legacy/usr/bin:/usr/obj/usr/src/tmp/legacy/bin:/usr/obj/usr/src/tmp/usr/sbin:/usr/obj/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin > CC="cc " CXX="c++ " DEPFLAGS="" CPP="cpp " AS="as" AR="ar" LD="ld" > NM=nm OBJDUMP=objdump OBJCOPY="objcopy" RANLIB=ranlib STRINGS= > SIZE="size" make -j 12 -J 15,16 -m /usr/src/share/mk KERNEL=kernel > cleandir > make[2]: "/usr/src/sys/conf/kern.pre.mk" line 105: "CFLAGS: -O2 -pipe > -fno-strict-aliasing -g -nostdinc -I. -I/usr/src/sys -D_KERNEL > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h" > > From /usr/obj/usr/src/sys/GENERIC/Makefile: > > 1 KERN_IDENT=GENERIC > 2 MACHINE=amd64 > 3 MACHINE_ARCH=amd64 > 4 WITH_CTF=1 > 5 DEBUG=-g > 6 S=/usr/src/sys As a sidenote, this has been broken for over a decade: https://svnweb.freebsd.org/base?view=revision&revision=127204 :(...
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMC10JJs7f9yzmNpeHNN8sM9ZFci1gpvqwqhvcGSQS4RXA>