Date: Fri, 26 Feb 2010 17:28:27 +0200 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: "Dr. Baud" <drbaud@yahoo.com> Cc: freebsd-hackers@freebsd.org Subject: Re: debug libraries Message-ID: <87y6igow2s.fsf@kobe.laptop> In-Reply-To: <87341.15532.qm@web65601.mail.ac4.yahoo.com> (Baud's message of "Thu, 25 Feb 2010 11:09:36 -0800 (PST)") References: <87341.15532.qm@web65601.mail.ac4.yahoo.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 25 Feb 2010 11:09:36 -0800 (PST), "Dr. Baud" <drbaud@yahoo.com> 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<cpu> to CFLAGS auto= matically NO_CPU_COPTFLAGS=3D # Don't add -march=3D<cpu> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87y6igow2s.fsf>