aboutdebug.xml 2.0 KB

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