[6370fa6] | 1 | <sect1 id="ch06-aboutdebug">
|
---|
| 2 | <title>About debugging symbols</title>
|
---|
[576e206] | 3 | <?dbhtml filename="aboutdebug.html" dir="chapter06"?>
|
---|
[6370fa6] | 4 |
|
---|
[2c094d6] | 5 | <para>Most programs and libraries are, by default, compiled with debugging
|
---|
[44c2fd8] | 6 | symbols included (with gcc option -g).</para>
|
---|
[6370fa6] | 7 |
|
---|
[44c2fd8] | 8 | <para>When debugging a program or library that was compiled with debugging
|
---|
| 9 | information included, the debugger can give you not only memory addresses
|
---|
| 10 | but also the names of the routines and variables.</para>
|
---|
| 11 |
|
---|
| 12 | <para>But the inclusion of these debugging symbols enlarges a program or
|
---|
| 13 | library significantly. To get an idea of the amount of space these symbols
|
---|
| 14 | occupy, have a look at the following:</para>
|
---|
[6370fa6] | 15 |
|
---|
| 16 | <itemizedlist>
|
---|
| 17 |
|
---|
[44c2fd8] | 18 | <listitem><para>a bash binary
|
---|
| 19 | with debugging symbols: 1200 KB</para></listitem>
|
---|
[6370fa6] | 20 |
|
---|
[44c2fd8] | 21 | <listitem><para>a bash binary
|
---|
| 22 | without debugging symbols: 480 KB</para></listitem>
|
---|
[6370fa6] | 23 |
|
---|
[4fa86d1] | 24 | <listitem><para>Glibc and GCC files (/lib and /usr/lib)
|
---|
[44c2fd8] | 25 | with debugging symbols: 87 MB</para></listitem>
|
---|
[6370fa6] | 26 |
|
---|
[4fa86d1] | 27 | <listitem><para>Glibc and GCC files
|
---|
[44c2fd8] | 28 | without debugging symbols: 16 MB</para></listitem>
|
---|
[6370fa6] | 29 |
|
---|
| 30 | </itemizedlist>
|
---|
| 31 |
|
---|
[44c2fd8] | 32 | <para>Sizes may vary a little, depending on which compiler was used and
|
---|
| 33 | which C library. But when comparing programs with and without debugging
|
---|
| 34 | symbols, the difference will generally be a factor between 2 and 5.</para>
|
---|
| 35 |
|
---|
| 36 | <para>As most people will probably never use a debugger on their system
|
---|
| 37 | software, a lot of disk space can be regained by removing these symbols .</para>
|
---|
[abdeaad6] | 38 |
|
---|
[44c2fd8] | 39 | <para>To remove debugging symbols from a binary (which must be an a.out
|
---|
| 40 | or ELF binary), run <userinput>strip --strip-debug filename</userinput>.
|
---|
| 41 | Wildcards can be used to treat multiple files (use something like
|
---|
[148bb04] | 42 | <userinput>strip --strip-debug $LFS/tools/bin/*</userinput>).</para>
|
---|
[6370fa6] | 43 |
|
---|
[7f1fcd8] | 44 | <para>For your convenience, <xref linkend="chapter09"/> includes one simple
|
---|
| 45 | command to strip all debugging symbols from all programs and libraries on your
|
---|
| 46 | system. Additional information on optimization can be found in the hint at
|
---|
[44c2fd8] | 47 | <ulink url="&hints-root;optimization.txt"/>.</para>
|
---|
[5c453fa] | 48 |
|
---|
[6370fa6] | 49 | </sect1>
|
---|
| 50 |
|
---|