aboutdebug.xml 2.2 KB

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