[Nix-dev] Debugging Symbols

Eelco Dolstra eelco.dolstra at logicblox.com
Mon Feb 15 17:45:46 CET 2016


Hi,

On 15/02/16 15:43, Kevin Cox wrote:

> The solution is obviously seperate debug files
> <https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html> which
> allows the debugging symbols to be kept separate from the binary itself. I see
> that there was an earlier attempt but it appears to have failed due to profile
> linking issues
> (https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/config/debug-info.nix).

Not sure I understand the problem. That *is* the supported way on NixOS to get
debug symbols, and AFAIK it works. What's the profile linking issue you refer to?

> I also think that this approach isn't ideal because it requires the program to
> be "installed" which is generally not the case for my system services.

Yes, currently it only includes debug info for packages in
environment.systemPackages, but this could fairly easily be extended to packages
in the path of systemd services, or maybe even all packages in the system
closure. You can also explicitly include debug symbols, e.g.

  environment.systemPackages = [ hello.debug ];

> - Embed the path of the debug symbols in the .gnu_debuglink section using a
> hacky path.

The current implementation uses the .gnu.build-id (essentially a cryptographic
hash of the ELF object), which is unambiguous and allows you to look up the
debug info of any ELF object in a content-addressed way.

(At FOSDEM, Mark Wielaard [1] mentioned that we should really have a little FUSE
filesystem to make a repository of *all* debug symbols available to GDB over the
network, so you don't have to install them manually. That would be really neat...)

[1]
https://fosdem.org/2016/schedule/event/where_are_your_symbols_debuginfo_and_sources/

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list