From owner-freebsd-arch@FreeBSD.ORG Wed Aug 7 07:58:47 2013 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D5FC8843 for ; Wed, 7 Aug 2013 07:58:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2B3D7218C for ; Wed, 7 Aug 2013 07:58:46 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA20803; Wed, 07 Aug 2013 10:58:29 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1V6ydZ-000O4p-7o; Wed, 07 Aug 2013 10:58:29 +0300 Message-ID: <5201FDED.8000408@FreeBSD.org> Date: Wed, 07 Aug 2013 10:57:33 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130708 Thunderbird/17.0.7 MIME-Version: 1.0 To: Jilles Tjoelker Subject: Re: amd64: -O2 even with DEBUG References: <51F221D4.8040308@FreeBSD.org> <20130726185425.GS26412@funkthat.com> <51F37578.2080405@FreeBSD.org> <20130804202823.GB39246@stack.nl> In-Reply-To: <20130804202823.GB39246@stack.nl> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Aug 2013 07:58:47 -0000 on 04/08/2013 23:28 Jilles Tjoelker said the following: > On the other hand, the difference between DEBUG and !DEBUG should be > minimized to avoid heisenbugs and taking advantage of undefined > behaviour that does not work at -O2. This does make sense. But shouldn't all architectures be equal in this respect? > Also note that most standard kernel configuration files have the line > > makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols > > which suggests that it only adds debug symbols and does not lower the > optimization level (even though that is only the case on amd64). Exactly -- this is only the case on amd64, for all other architectures DEBUG implies -O. > So it seems you are asking about lowering the optimization level of > almost all amd64 kernels (there seems little reason not to generate > .symbols files). No, I am just asking for consistency. That is, if amd64 is so special among all the platforms and flavors then let this be explicitly stated somewhere. If not, then let it follow what all other architectures do. Or, conversely, all other architectures should do what amd64 does. > In my experience, debugging -O2 code is usually possible with > experience, knowledge about compiler optimizations and good compilers > and debuggers (for example, gcc and gdb were improved in this area after > the switch to GPLv3). It can be rather annoying, though, if there is a > lot of inlining or the value of the variable you need is not available > (the value may be available elsewhere in the call chain or not at all). All true. Especially kgdb-over-{email,irc} becomes annoyingly hard. -- Andriy Gapon