From owner-freebsd-hackers@FreeBSD.ORG Tue May 31 14:39:14 2011 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 1233) id 12444106566B; Tue, 31 May 2011 14:39:14 +0000 (UTC) Date: Tue, 31 May 2011 14:39:14 +0000 From: Alexander Best To: Garrett Cooper Message-ID: <20110531143914.GA30260@freebsd.org> References: <3BF63174-1B29-4A4D-96DD-3ED65ED96EAC@bsdimp.com> <20110527181459.GA29908@freebsd.org> <20110527182906.GA31871@freebsd.org> <86oc2mlsey.fsf@gmail.com> <20110528182326.GA75447@freebsd.org> <20110528202619.GA27204@muon.cran.org.uk> <20110531095742.GA99888@freebsd.org> <4DE4C4CC.4020905@FreeBSD.org> <20110531104639.GA4218@freebsd.org> <24ADBA34-A5FC-4A67-8D6F-3BDAE158285C@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <24ADBA34-A5FC-4A67-8D6F-3BDAE158285C@gmail.com> Cc: Bruce Cran , "freebsd-hackers@FreeBSD.ORG" , "freebsd-toolchain@FreeBSD.ORG" , Dimitry Andric , Pan Tsu Subject: Re: [rfc] a few kern.mk and bsd.sys.mk related changes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 May 2011 14:39:14 -0000 On Tue May 31 11, Garrett Cooper wrote: > On May 31, 2011, at 3:46 AM, Alexander Best wrote: > > > On Tue May 31 11, Dimitry Andric wrote: > >> On 2011-05-31 11:57, Alexander Best wrote: > >> ... > >>>>> however i've often read messages - mostly by bruce evans - claiming that > >>>>> anything greater than -O will in fact decrease a kernel's ability to be > >>>>> debugged just as well as a kernel with -O. > >>>> The critical option when -O2 is used is -fno-omit-frame-pointers, since > >>>> removing > >>>> frame pointers makes debugging impossible (on i386). With -O2 code is > >>>> moved around and > >>>> removed, so debugging is more difficult, but can still provide useful > >>>> information. > >>> any reason we cannot use -O2 -fno-omit-frame-pointers -fno-strict-aliasing > >>> as > >>> standard COPTFLAGS with debugging enabled for *all* archs? > >> > >> Most likely, the performance gain from -O2 is rather small, except for > >> special cases, but the pain during debugging is increased a great deal. > >> > >> Even if you add frame pointers, with -O2 large pieces of code can be > >> transformed, variables or even entire functions can be completely > >> eliminated, and so on, making debugging much more difficult. > > > > *lol* we're moving in circles. so back to the beginning: why not use -O > > for all archs, if debugging was enabled? for amd64 -O2 is always set, no > > matter, if debugging is enabled or disabled. > > I don't know, but I've run into cases where gcc has inlined or shuffled around code on amd64 with -O2 -fno-strict-aliasing, so I changed my make.conf to use -O0 when DEBUG_FLAGS was defined. ...which leads me to the conclusion that -O should be set when DEBUG was defined: an all ARCHS. right now -fno-omit-frame-pointer is only set on amd64 and powerpc, if the kernel contains DDB, KDTRACE_FRAME or HWPMC. how about this behavior? shouldn't -fno-omit-frame-pointer be set uncondtitionally on all archs? just like -fno-strict-aliasing? cheers. alex > Thanks, > -Garrett -- a13x