[6370fa6] | 1 | <sect1 id="ch06-aboutdebug">
|
---|
| 2 | <title>About debugging symbols</title>
|
---|
| 3 |
|
---|
[b822811] | 4 | <para>Most programs and libraries by default are compiled with debugging
|
---|
[abdeaad6] | 5 | symbols (gcc option -g) Let me explain what these debugging symbols
|
---|
[b822811] | 6 | are and why you may not want them.</para>
|
---|
[6370fa6] | 7 |
|
---|
[b822811] | 8 | <para>A program compiled with debugging symbols means a user can run a program
|
---|
| 9 | or library through a debugger and the debugger's output will be user
|
---|
[abdeaad6] | 10 | friendly. These debugging symbols also enlarge the program or library
|
---|
[b822811] | 11 | significantly.</para>
|
---|
[6370fa6] | 12 |
|
---|
[b822811] | 13 | <para>Before you start wondering whether these debugging symbols really make a
|
---|
[abdeaad6] | 14 | big difference, here are some statistics. Use them to draw your own
|
---|
[b822811] | 15 | conclusion.</para>
|
---|
[6370fa6] | 16 |
|
---|
| 17 | <itemizedlist>
|
---|
| 18 |
|
---|
[b822811] | 19 | <listitem><para>A dynamic Bash binary
|
---|
| 20 | with debugging symbols: 1.2MB</para></listitem>
|
---|
[6370fa6] | 21 |
|
---|
[b822811] | 22 | <listitem><para>A dynamic Bash binary
|
---|
| 23 | without debugging symbols: 478KB</para></listitem>
|
---|
[6370fa6] | 24 |
|
---|
[b822811] | 25 | <listitem><para>/lib and /usr/lib (glibc
|
---|
| 26 | and gcc files) with debugging symbols: 87MB</para></listitem>
|
---|
[6370fa6] | 27 |
|
---|
[b822811] | 28 | <listitem><para>/lib and /usr/lib (glibc
|
---|
| 29 | and gcc files) without debugging symbols: 16MB</para></listitem>
|
---|
[6370fa6] | 30 |
|
---|
| 31 | </itemizedlist>
|
---|
| 32 |
|
---|
[b822811] | 33 | <para>Sizes vary depending on which compiler was used and which C library
|
---|
[81a47c0] | 34 | version was used to link dynamic programs against, but results will be
|
---|
[abdeaad6] | 35 | similar if you compare programs with and without debugging symbols. After
|
---|
[6370fa6] | 36 | I was done with this chapter and stripped all debugging symbols from all LFS
|
---|
[b822811] | 37 | binaries I regained a little over 102 MB of disk space. Quite the
|
---|
| 38 | difference.</para>
|
---|
[abdeaad6] | 39 |
|
---|
[b822811] | 40 | <para>To remove debugging symbols from a binary (must be an a.out or ELF
|
---|
[abdeaad6] | 41 | binary) run <userinput>strip --strip-debug filename</userinput>. Wild cards
|
---|
| 42 | can be used to strip debugging symbols from multiple files (use something
|
---|
| 43 | like <userinput>strip --strip-debug $LFS/usr/bin/*</userinput>).
|
---|
| 44 | Most people will probably never use a debugger on software, so by
|
---|
[b822811] | 45 | removing those symbols a lot of disk space can be regained.</para>
|
---|
[6370fa6] | 46 |
|
---|
[b822811] | 47 | <para>You might find additional information in the optimization hint which can
|
---|
[b4ffa369] | 48 | be found at <ulink
|
---|
[a4a7eff] | 49 | url="&hint-root;optimization.txt">&hint-root;optimization.txt</ulink>
|
---|
[b822811] | 50 | .</para>
|
---|
[5c453fa] | 51 |
|
---|
[6370fa6] | 52 | </sect1>
|
---|
| 53 |
|
---|