[Nix-dev] Re: Support for debugging symbols

Tony White tonywhite100 at googlemail.com
Thu Apr 23 01:43:16 CEST 2009


2009/4/22 Ludovic Courtès <ludo at gnu.org>:
> ludo at gnu.org (Ludovic Courtès) writes:
>
>>   1. Build the derivation and install it unstripped.
>>
>>   2. Create a `-dbg' derivation containing the output of
>>      `--only-keep-debug' for that package.
>>
>>   3. Create a stripped derivation of (1) with a "debuglink" to (2).
>>
>> However, this approach is pointless since (3) would hold a reference to
>> both (1) and (2), thereby occupying as much space as a simple unstripped
>> install.
>
> Actually, according to the GDB manual (info "(gdb)Separate Debug
> Files"), the debug link doesn't have to be an absolute path name, so we
> can avoid the link from (3) to (2):
>
>   * For the "debug link" method, GDB looks up the named file in the
>     directory of the executable file, then in a subdirectory of that
>     directory named `.debug', and finally under the global debug
>     directory, in a subdirectory whose name is identical to the leading
>     directories of the executable's absolute file name.
>
> Nevertheless, the "global debug directory" approach doesn't sound good
> to me, as we could end up loading debugging symbols that don't
> correspond to the binary.
>
> Hmm, needs more thought.
>
> Ludo'.
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at cs.uu.nl
> https://mail.cs.uu.nl/mailman/listinfo/nix-dev
>

debug packages could be a completely new seperate set of expressions
in the development section of nixpkgs.
A debug = enabled switch could be made available to expressions, which
skips any stdenv stripping.
If you are debugging, I think it makes sense not to strip anything.
Any debug tools that are likely to be needed will need to be added to
the path at configure time anyway, such as gdb for kde 4 packages so
seperate seems better to me.
debug packages are then created by passing --enable-debug using a
builder, to the configure script.
Just adding a debug switch to existing expressions wouldn't work
because pulling trunk and then nixos-rebuild switch could build an
updated package from what has just arrived from trunk and the debug =
enabled switch would be gone for each update.
You'd just want the update built for debugging if you were doing that
in the first place.

The stripping of debug symbols that Ludovic mentions is used in the
following way by Mandriva. The entire development distribution
(Cooker) Is a debug distribution, every package is built with debug
symbols but as many debug symbols as possible are stripped out into
seperate pre-compiled rpm packages which are then made available to
developers that want to debug but not installed by default as
dependencies.
The debug symbols are then completely removed at release time.
Seperate precompiled debug packages are then made available for the
release that replace the packages without debug symbols, when they are
installed by developers that want to debug the stable release.

Wanting hydra to build seperate debug packages might not be a great
idea IMO but I don't know about how big the resources you guys have
access to or how often old builds are purged.

Just my thoughts, the stripping certainly isn't useful for debugging
and it is quite a pickle.
I hope that there is a sensible solution,

Tony



More information about the nix-dev mailing list