[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debug packages cluttering the archive



On Sun, Feb 06, 2005 at 01:14:09AM -0500, Glenn Maynard wrote:

 > (Aha: the strip tool mentioned is in elfutils, which is non-free.
 > Blah.)

 objcopy(1):

  --only-keep-debug
      Strip a file, removing any  sections  that  would  be  stripped  by
      --strip-debug and leaving the debugging sections.

      The  intention is that this option will be used in conjunction with
      --add-gnu-debuglink  to  create  a  two  part  executable.   One  a
      stripped  binary  which will occupy less space in RAM and in a dis-
      tribution and the second a debugging information file which is only
      needed  if  debugging abilities are required.  The suggested proce-
      dure to create these files is as follows:

      1.<Link the executable as normal.  Assuming that is is called>
          "foo" then...

      1.<Run "objcopy --only-keep-debug foo foo.dbg" to>
          create a file containing the debugging info.

      1.<Run "objcopy --strip-debug foo" to create a>
          stripped executable.

      1.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
          to add a link to the debugging  info  into  the  stripped  exe-
          cutable.

      Note - the choice of ".dbg" as an extension for the debug info file
      is arbitrary.  Also the "--only-keep-debug" step is optional.   You
      could instead do this:

      1.<Link the executable as normal.>
      1.<Copy "foo" to  "foo.full">
      1.<Run "objcopy --strip-debug foo">
      1.<Run "objcopy --add-gnu-debuglink=foo.full foo">

      ie  the  file pointed to by the --add-gnu-debuglink can be the full
      executable.  It  does  not  have  to  be  a  file  created  by  the
      --only-keep-debug switch.

-- 
Marcelo



Reply to: