From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 26 18:07:49 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE1911065675 for ; Fri, 26 Feb 2010 18:07:49 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 33AC18FC16 for ; Fri, 26 Feb 2010 18:07:48 +0000 (UTC) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id B9B10EB48C3; Fri, 26 Feb 2010 20:07:47 +0200 (EET) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 9984B160CEB; Fri, 26 Feb 2010 20:07:47 +0200 (EET) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I97WTAvm17jB; Fri, 26 Feb 2010 20:07:47 +0200 (EET) Received: from kobe.laptop (ppp-94-64-198-255.home.otenet.gr [94.64.198.255]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 33BA2160CE4; Fri, 26 Feb 2010 20:07:47 +0200 (EET) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.4/8.14.4) with ESMTP id o1QI7jlJ003152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 26 Feb 2010 20:07:45 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.4/8.14.4/Submit) id o1QI7imk003147; Fri, 26 Feb 2010 20:07:44 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: "Dr. Baud" In-Reply-To: <87341.15532.qm@web65601.mail.ac4.yahoo.com> (Baud's message of "Thu, 25 Feb 2010 11:09:36 -0800 (PST)") Date: Fri, 26 Feb 2010 17:28:27 +0200 Message-ID: <87y6igow2s.fsf@kobe.laptop> References: <87341.15532.qm@web65601.mail.ac4.yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: debug libraries 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: Fri, 26 Feb 2010 18:07:49 -0000 On Thu, 25 Feb 2010 11:09:36 -0800 (PST), "Dr. Baud" wro= te: > Apologies if this is the wrong list.... > > Are there prepackaged debug versions of the system libraries available > (like 'yum install *-debuginfo' in Fedora and 'apt-get install *-dbg' > in Ubuntu)? No, not really. You can always build a base system *with* debugging symbols from source though. Naturally, this is not as fast to install as a small set of pre-built packages, but it is at least possible. For example, my laptop runs a base system _with_ debugging symbols most of the time. To rebuild everything I made the following changes to my '/etc/make.conf' file: 1. I enabled the DEBUG_FLAGS option, by adding the following: DEBUG_FLAGS ?=3D -g 2. I checked that I am not using high optimization levels in CFLAGS or COPTFLAGS. 3. I enabled the NO_CPU_CFLAGS and NO_CPU_COPTFLAGS options: NO_CPU_CFLAGS=3D # Don't add -march=3D to CFLAGS auto= matically NO_CPU_COPTFLAGS=3D # Don't add -march=3D to COPTFLAGS a= utomatically Then I rebuilt everything from my latest source tree at /usr/src. The combined effect of NO_CPU_CFLAGS and DEBUG_FLAGS is that binaries are not stripped before they are installed, and optimization flags are not added automatically by the build system. Note #1. The resulting binaries are *much* larger. For example the ed(1) editor in unstripped format is 123 KB on my laptop, but stripping it reduces its size down to 48 KB: keramida@kobe:/tmp$ ls -ld /bin/ed -r-xr-xr-x 2 root wheel - 123663 16 =CE=A6=CE=B5=CE=B2 12:25 /bi= n/ed keramida@kobe:/tmp$ cp -a /bin/ed ed keramida@kobe:/tmp$ sudo strip -s ed keramida@kobe:/tmp$ ls -ld ed -r-xr-xr-x 1 keramida wheel - 48400 26 =CE=A6=CE=B5=CE=B2 17:24 ed The effect of enabling debugging flags for larger programs like gcc, gdb or bind is much much larger than ed(1) of course. Note #2. There's probably a measurable performance hit by running a debugging base system, because -O2 optimizations do not get a chance to do their magic as you build your binaries. HTH, Giorgos