Date: Mon, 18 May 2015 15:44:19 -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: <CAGHfRMAGTF0oh%2BR0kDxyx7PWSPfcTyZT-cMogF_LrV5pR2J4-w@mail.gmail.com> In-Reply-To: <20150509190347.10e1e2c2@kan> References: <554E41EE.2010202@ignoranthack.me> <554E4BD1.1030802@ignoranthack.me> <406EAA27-D825-408B-985E-DC3FFE746473@frob.org> <554E5263.8010205@ignoranthack.me> <20150509190347.10e1e2c2@kan>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, May 9, 2015 at 4:03 PM, Alexander Kabaev <kabaev@gmail.com> wrote: > On Sat, 09 May 2015 11:30:59 -0700 > Sean Bruno <sbruno@ignoranthack.me> wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA512 >> >> On 05/09/15 11:09, Jeff Meegan wrote: >> > You could try -O0, but also if you just care about txr, go up to >> > frame 12 where txr initialized to the context arg to em_handle_tx() >> > and print it out there. >> > >> > -j >> >> I'm guessing that the place to change -O2 -> -O0 is in kern.pre.mk ? >> >> sean > > No, it means you need to iescover DEBUG and how it affects optimization > level :) > > .if defined(DEBUG) > _MINUS_O= -O > CTFFLAGS+= -g > .else > ... > > Say, I have 'makeoptions DEBUG="-g -gdwarf-2"' in my kernel config > file. -gdwarf-2 is probably not required anymore. 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGHfRMAGTF0oh%2BR0kDxyx7PWSPfcTyZT-cMogF_LrV5pR2J4-w>