Debug Symbols: Difference between revisions

imported>Symphorien
Unstripped packages: mention the difference between dontStrip and enableDebugging
imported>Jtojnar
Mention dwarffs
Line 126: Line 126:


==== NixOS ====
==== NixOS ====
By toggling <code>environment.enableDebugInfo</code> to 'true' in <code>/etc/nixos/configuration.nix</code>, all
By toggling <code>environment.enableDebugInfo</code> to 'true' in <code>/etc/nixos/configuration.nix</code>, all separate debug info derivations in your <code>systemPackages</code> will have their debug output linked in <code>/run/current-system/sw/lib/debug/</code> and will be automatically available to gdb. Though note that this will not pick up debug symbols of dependencies – you will need to add the dependencies you want to debug to <code>environment.systemPackages</code> explicitly. If a derivation you are interested in does not have separate debug info enabled, you still have to override it with an overlay for example.
separate debug info derivations in your <code>systemPackages</code> will have their debug output linked in <code>/run/current-system/sw/lib/debug/</code> and
 
will be automatically available to gdb. If a derivation you are interested in does not have separate debug info enabled, you
==== dwarffs ====
still have to override it with an overlay for example.
To avoid the need to explicitly list every dependency in <code>environment.systemPackages</code> to have its debug output available, you can use [https://github.com/edolstra/dwarffs dwarffs]. It will create a virtual file system where gdb will be able to look for separate debug symbols for packages on-demand. The downside is that it might increase gdb start up time significantly.