aboutdebug.xml 1.9 KB

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