diff options
author | Domen Kožar <domen@dev.si> | 2017-09-01 16:49:50 +0200 |
---|---|---|
committer | Domen Kožar <domen@enlambda.com> | 2017-09-02 11:25:50 +0100 |
commit | 991654fa4ab7be07ce70b02bcc935491239a52c5 (patch) | |
tree | cb0cdee8026ddaab547fd12dd0b81bc0f1e4bf75 /pkgs/development/haskell-modules/lib.nix | |
parent | b7d257a5207f3b7e9cfe002e8b77853c97d5b697 (diff) |
haskell: add combinator to enable DWARF debugging
Tested using:
$ cat test-strip.nix
with (import ./. {});
with haskell.lib;
haskell.packages.ghc802.override {
overrides = self: super: {
microlens = enableDWARFDebugging super.microlens;
};
}
$ nix-build -A microlens test-strip.nix
$ objdump -t <path-to-so-file>
Diffstat (limited to '')
-rw-r--r-- | pkgs/development/haskell-modules/lib.nix | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index 6da19794f6f4..48110cffabf8 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -73,6 +73,17 @@ rec { disableHardening = drv: flags: overrideCabal drv (drv: { hardeningDisable = flags; }); + # Controls if Nix should strip the binary files (removes debug symbols) + doStrip = drv: overrideCabal drv (drv: { dontStrip = false; }); + dontStrip = drv: overrideCabal drv (drv: { dontStrip = true; }); + + # Useful for debugging segfaults with gdb. + # -g: enables debugging symbols + # --disable-*-stripping: tell GHC not to strip resulting binaries + # dontStrip: see above + enableDWARFDebugging = drv: + appendConfigureFlag (dontStrip drv) "--ghc-options=-g --disable-executable-stripping --disable-library-stripping"; + sdistTarball = pkg: lib.overrideDerivation pkg (drv: { name = "${drv.pname}-source-${drv.version}"; # Since we disable the haddock phase, we also need to override the |