Add a setup hook to fill NIX_DEBUG_INFO_DIRS

This setup hook is propagated by gdb. Thus, a typical use is:

  $ nix-shell -p gdb nix nix.debug sqlite.debug ...

and gdb will be able find the debug symbols of nix etc. automatically.
This commit is contained in:
Eelco Dolstra 2017-07-28 14:22:48 +02:00
parent 5b09152898
commit 5c5b71df5e
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
3 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,5 @@
setupDebugInfoDirs () {
addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug
}
envHooks+=(setupDebugInfoDirs)

View File

@ -11,6 +11,8 @@
# Additional dependencies for GNU/Hurd.
, mig ? null, hurd ? null
, setupDebugInfoDirs
}:
let
@ -34,7 +36,7 @@ stdenv.mkDerivation rec {
patches = [ ./debug-info-from-env.patch ];
nativeBuildInputs = [ pkgconfig texinfo perl ]
nativeBuildInputs = [ pkgconfig texinfo perl setupDebugInfoDirs ]
# TODO(@Ericson2314) not sure if should be host or target
++ stdenv.lib.optional targetPlatform.isHurd mig;
@ -43,6 +45,8 @@ stdenv.mkDerivation rec {
++ stdenv.lib.optional targetPlatform.isHurd hurd
++ stdenv.lib.optional doCheck dejagnu;
propagatedNativeBuildInputs = [ setupDebugInfoDirs ];
enableParallelBuilding = true;
# darwin build fails with format hardening since v7.12

View File

@ -347,6 +347,8 @@ with pkgs;
separateDebugInfo = makeSetupHook { } ../build-support/setup-hooks/separate-debug-info.sh;
setupDebugInfoDirs = makeSetupHook { } ../build-support/setup-hooks/setup-debug-info-dirs.sh;
useOldCXXAbi = makeSetupHook { } ../build-support/setup-hooks/use-old-cxx-abi.sh;
iconConvTools = callPackage ../build-support/icon-conv-tools {};