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