1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR2//EN" "http://www.docbook.org/xml/4.3CR2/docbookx.dtd">
3 <sect1 id="ch06-aboutdebug">
4 <title>About debugging symbols</title>
5 <?dbhtml filename="aboutdebug.html"?>
7 <para>Most programs and libraries are, by default, compiled with debugging
8 symbols included (with gcc option -g).</para>
10 <para>When debugging a program or library that was compiled with debugging
11 information included, the debugger can give you not only memory addresses
12 but also the names of the routines and variables.</para>
14 <para>But the inclusion of these debugging symbols enlarges a program or
15 library significantly. To get an idea of the amount of space these symbols
16 occupy, have a look at the following:</para>
20 <listitem><para>a bash binary
21 with debugging symbols: 1200 KB</para></listitem>
23 <listitem><para>a bash binary
24 without debugging symbols: 480 KB</para></listitem>
26 <listitem><para>Glibc and GCC files (/lib and /usr/lib)
27 with debugging symbols: 87 MB</para></listitem>
29 <listitem><para>Glibc and GCC files
30 without debugging symbols: 16 MB</para></listitem>
34 <para>Sizes may vary a little, depending on which compiler was used and
35 which C library. But when comparing programs with and without debugging
36 symbols, the difference will generally be a factor between 2 and 5.</para>
38 <para>As most people will probably never use a debugger on their system
39 software, a lot of disk space can be regained by removing these symbols .</para>
41 <para>To remove debugging symbols from a binary (which must be an a.out
42 or ELF binary), run <userinput>strip --strip-debug filename</userinput>.
43 Wildcards can be used to treat multiple files (use something like
44 <userinput>strip --strip-debug $LFS/tools/bin/*</userinput>).</para>
46 <para>For your convenience, <xref linkend="chapter09"/> includes one simple
47 command to strip all debugging symbols from all programs and libraries on your
48 system. Additional information on optimization can be found in the hint at
49 <ulink url="http://www.linuxfromscratch.org/hints/downloads/files/optimization.txt"/>.</para>