[Novalug] gdb tidbit - objcopy

Paul W. Frields stickster at gmail.com
Tue Jun 12 22:15:28 EDT 2007


On Tue, 2007-06-12 at 13:15 -0400, Doug Toppin wrote:
> A ways back I did a couple of presentations on using the gdb debugger.
>  I just ran across something I didn't know about called 'objcopy'
> (copy and translate object files).  It can be used to manupulate
> object files (binaries) in various ways.  One of the options it
> supports is '--only-keep-debug'.   Using that on an executable with
> symbol data will create a new file containing only the debug symbol
> data.  This would allow you to build a fully debuggable binary, output
> the debug symbols to another file and then strip the original.   You
> can then load the debug symbols later in a gdb session with the gdb
> 'symbol' command.  The reasons for doing this might include space
> savings or not wanting to provide a debug capability in your delivery.
>  I'm sure that there are other useful situations for doing that.
> 
> I thought I'd pass along a mention of 'objcopy' in case anyone else
> might find some benefit with it.   Anyone else used it in the past?

Cf. /usr/bin/strip from binutils?  I believe this is how "debuginfo"
RPMs are created and separated from binary RPMs for Fedora, probably
others.  Probably many ways to skin this cat as with all UNIX
toolsets... :-)

-- 
Paul W. Frields, RHCE                          http://paul.frields.org/
  gpg fingerprint: 3DA6 A0AC 6D58 FEC4 0233  5906 ACDB C937 BD11 3717
      Fedora Project:  http://fedoraproject.org/wiki/PaulWFrields
  irc.freenode.net: stickster @ #fedora-docs, #fedora-devel, #fredlug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://calypso.tux.org/pipermail/novalug/attachments/20070612/e50e57b8/attachment.bin 


More information about the Novalug mailing list