Skip to content

Support for NIX_DEBUG_INFO_DIRS? #24

@lf-

Description

@lf-

nixpkgs patches all the debuggers and similar things on the system to use NIX_DEBUG_INFO_DIRS to provide debuginfo to them. I am not sure the "normal" way to do this, but nix likely needs to do it this way to separate the debug info completely from the executables.

This environment variable points to a colon separated list of directories that look like this:

$ ls -la /nix/store/rg9fcbxbvy11s7k2mcm0lawy3mr6hnqj-lix-2.93.0-dev-pre20250224-945e674-debug/lib/debug
total 7
dr-xr-xr-x 3 root root 10 Dec 31  1969 .
dr-xr-xr-x 3 root root  3 Dec 31  1969 ..
dr-xr-xr-x 9 root root  9 Dec 31  1969 .build-id
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixcmd.so -> .build-id/e8/e34f38dcd81be6179a91cd00457afec379d2a2.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixexpr.so -> .build-id/3e/e59d82e59d5be9c529f748dee3b66aeba6732f.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixfetchers.so -> .build-id/f5/0cb975e366879b0c4ace3a16bb922da47f7b91.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixmain.so -> .build-id/bc/ff2e67f9db67b4331160272e5755c51de332e4.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixstore.so -> .build-id/2c/2e1f6133b8e7cb9330cfd8a271b51ac2f2fc30.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 liblixutil.so -> .build-id/7a/3fe512e965b6e0190ecf8911159d8f32feb15b.debug
lrwxrwxrwx 1 root root 57 Dec 31  1969 nix -> .build-id/ae/f9fb63a1b210c0c21d981e75dcda406cc943d3.debug

$ file $(realpath /nix/store/rg9fcbxbvy11s7k2mcm0lawy3mr6hnqj-lix-2.93.0-dev-pre20250224-945e674-debug/lib/debug/nix)
/nix/store/rg9fcbxbvy11s7k2mcm0lawy3mr6hnqj-lix-2.93.0-dev-pre20250224-945e674-debug/lib/debug/.build-id/ae/f9fb63a1b210c0c21d981e75dcda406cc943d3.debug: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter *empty*, BuildID[sha1]=aef9fb63a1b210c0c21d981e75dcda406cc943d3, for GNU/Linux 3.10.0, with debug_info, not stripped

I would like to be able to upload traces from executions of such programs, ideally by using the familiar environment variable as I would do for rr replay on Nix systems.

This is the gdb patch used to implement these:
https://github.com/nixos/nixpkgs/blob/e6491be4e39a7dcd1337ba50cccc00a59c8f44aa/pkgs/development/tools/misc/gdb/debug-info-from-env.patch#L1-L17

I think I can do the sources by --copy-sources? I am not sure what --build-dir does and whether it is the NIX_DEBUG_INFO_DIRS behaviour; at the very least it seems to be in the singular, which seems like it might be a problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions