1 | <sect1 id="ch06-aboutdebug">
|
---|
2 | <title>About debugging symbols</title>
|
---|
3 | <?dbhtml filename="aboutdebug.html" dir="chapter06"?>
|
---|
4 |
|
---|
5 | <para>Most programs and libraries are, by default, compiled with debugging
|
---|
6 | symbols included (with gcc option -g).</para>
|
---|
7 |
|
---|
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>
|
---|
15 |
|
---|
16 | <itemizedlist>
|
---|
17 |
|
---|
18 | <listitem><para>a bash binary
|
---|
19 | with debugging symbols: 1200 KB</para></listitem>
|
---|
20 |
|
---|
21 | <listitem><para>a bash binary
|
---|
22 | without debugging symbols: 480 KB</para></listitem>
|
---|
23 |
|
---|
24 | <listitem><para>glibc and gcc files (/lib and /usr/lib)
|
---|
25 | with debugging symbols: 87 MB</para></listitem>
|
---|
26 |
|
---|
27 | <listitem><para>glibc and gcc files
|
---|
28 | without debugging symbols: 16 MB</para></listitem>
|
---|
29 |
|
---|
30 | </itemizedlist>
|
---|
31 |
|
---|
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>
|
---|
38 |
|
---|
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
|
---|
42 | <userinput>strip --strip-debug $LFS/tools/bin/*</userinput>).</para>
|
---|
43 |
|
---|
44 | <para>For your convenience, Chapter 9 includes one simple command to strip
|
---|
45 | all debugging symbols from all programs and libraries on your system.
|
---|
46 | Additional information on optimization can be found in the hint at
|
---|
47 | <ulink url="&hints-root;optimization.txt"/>.</para>
|
---|
48 |
|
---|
49 | </sect1>
|
---|
50 |
|
---|