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