2001-01-24 00:31:17 +00:00
|
|
|
<sect1 id="ch06-aboutdebug">
|
|
|
|
<title>About debugging symbols</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Most programs and libraries by default are compiled with debugging
|
2001-03-23 03:27:23 +00:00
|
|
|
symbols (gcc option -g) Let me explain what these debugging symbols
|
|
|
|
are and why you may not want them.
|
2001-01-24 00:31:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2001-03-19 16:02:50 +00:00
|
|
|
A program compiled with debugging symbols means a user can run a program or
|
2001-03-23 03:27:23 +00:00
|
|
|
library through a debugger and the debugger's output will be user
|
|
|
|
friendly. These debugging symbols also enlarge the program or library
|
|
|
|
significantly.
|
2001-01-24 00:31:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2001-03-23 03:27:23 +00:00
|
|
|
Before you start wondering whether these debugging symbols really make a
|
|
|
|
big difference, here are some statistics. Use them to draw your own
|
|
|
|
conclusion.
|
2001-01-24 00:31:17 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<itemizedlist>
|
|
|
|
|
|
|
|
<listitem><para>
|
|
|
|
A dynamic Bash binary with debugging symbols: 1.2MB
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
<listitem><para>
|
|
|
|
A dynamic Bash binary without debugging symbols: 478KB
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
<listitem><para>
|
|
|
|
/lib and /usr/lib (glibc and gcc files) with debugging
|
|
|
|
symbols: 87MB
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
<listitem><para>
|
|
|
|
/lib and /usr/lib (glibc and gcc files) without
|
|
|
|
debugging symbols: 16MB
|
|
|
|
</para></listitem>
|
|
|
|
|
|
|
|
</itemizedlist>
|
|
|
|
|
|
|
|
<para>
|
2001-03-23 03:27:23 +00:00
|
|
|
Sizes vary depending on which compiler was used and which C library
|
2001-03-19 16:02:50 +00:00
|
|
|
version was used to link dynamic programs against, but results will be
|
2001-03-23 03:27:23 +00:00
|
|
|
similar if you compare programs with and without debugging symbols. After
|
2001-01-24 00:31:17 +00:00
|
|
|
I was done with this chapter and stripped all debugging symbols from all LFS
|
2001-03-23 03:27:23 +00:00
|
|
|
binaries I regained a little over 102 MB of disk space. Quite the difference.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To remove debugging symbols from a binary (must be an a.out or ELF
|
|
|
|
binary) run <userinput>strip --strip-debug filename</userinput>. Wild cards
|
|
|
|
can be used to strip debugging symbols from multiple files (use something
|
|
|
|
like <userinput>strip --strip-debug $LFS/usr/bin/*</userinput>).
|
|
|
|
Most people will probably never use a debugger on software, so by
|
|
|
|
removing those symbols a lot of diskspace can be regained.
|
2001-01-24 00:31:17 +00:00
|
|
|
</para>
|
|
|
|
|
2001-04-03 21:27:57 +01:00
|
|
|
<para>
|
|
|
|
You might find additional information in the optimization hint which can
|
|
|
|
be found at <ulink url="http://cvs.linuxfromscratch.org/index.cgi/hints/">
|
|
|
|
http://cvs.linuxfromscratch.org/index.cgi/hints/</ulink>.
|
|
|
|
</para>
|
|
|
|
|
2001-01-24 00:31:17 +00:00
|
|
|
</sect1>
|
|
|
|
|