On Thu, 17 Nov 2011 at 13:00:40 +0100, Malte Forkel wrote:
>  - What do you mean by
> > Don't strip in the upstream build. Just don't. Ever.
> Is it that any stripping should be initiated from debian/rules, but
> should never be performed by the upstream Makefiles?

Always build with -g, and never discard the debug symbols entirely.
The Debian way to strip debug symbols out of the "normal" library
is usually done with dh_strip, part of debhelper:

* first, objcopy(1) the debug symbols into files that will end up installed to
  /usr/lib/debug by the -dbg binary package - gdb knows how to find them
  there automatically

* then and only then, use strip(1) to remove the debug symbols from the
  "main" version of the library

The files in /usr/lib/debug are not complete libraries: they contain
the debug symbols which were previously in the corresponding library
in /usr/bin, but they do not contain any executable code.

This means the main library package is small (because it only contains the
executable code), but can still be debugged by installing the corresponding
-dbg package (which contains the corresponding debug symbols). While
debugging your program or library, gdb reads both the main library and its
debug symbols, and behaves as if the debug symbols had been in the main
library all along.

I've been saying "library", but some packages do the same for binaries
(e.g. dbus-dbg contains /usr/lib/debug/usr/bin/dbus-daemon, which contains
the debug symbols for /usr/bin/dbus-daemon, without duplicating the
executable code).

The dh_strip source code is very readable; have a look at it if you want
more detail.

    S


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
http://lists.debian.org/20111117121958.ga7...@reptile.pseudorandom.co.uk

Reply via email to