Description
Hi!
I'm working on making rr work better on Nix built binaries, and I would like to be able to retrieve the original paths of shared libraries, so that I can query more information about them from Nix (to grab debug symbols and sources for rr sources --substitute
) and fully automate this process.
Currently I have the following mediocre shell script:
#!/usr/bin/env bash
set -eu
args=()
replace_libs=(liblixcmd.so liblixexpr.so liblixfetchers.so liblixmain.so liblixstore.so liblixutil.so nix)
lix_src=$(debuginfo --src nix)
for lib in "${replace_libs[@]}"; do
args+=("--substitute=${lib}=${lix_src}")
done
export NIX_DEBUG_INFO_DIRS=$(debuginfo nix)
rr sources "${args[@]}" "$@"
But this needs to know which .so
files exist and which package they come from, in order to be able to provide the sources. Having to do this matching-up manually is no fun and error prone (since the trace might not have the same nix
as you had to start with, e.g., not to mention any libraries it uses).
What I want, specifically, is the /nix/store/gdfskhjsdfghlk-somepackage-version
paths, after rr record
completes:
$ ldd `which curl`
linux-vdso.so.1 (0x00007f535787b000)
libcurl.so.4 => /nix/store/simdgzgxrcqkvak7zpczr176rgbar3s5-curl-8.12.0/lib/libcurl.so.4 (0x00007f53577a0000)
libnghttp2.so.14 => /nix/store/gv1757ayjx08vj3jwaldj7fhdfg8kw0a-nghttp2-1.64.0-lib/lib/libnghttp2.so.14 (0x00007f535776
e000)
libidn2.so.0 => /nix/store/wm87zrqsi07as7jvr3lyzawhlql577l7-libidn2-2.3.7/lib/libidn2.so.0 (0x00007f535773d000)
libssh2.so.1 => /nix/store/kfbkndd5rn6mrh3lwc8ykss9xxv4jzhb-libssh2-1.11.1/lib/libssh2.so.1 (0x00007f53576f1000)
I talked to @khuey about this via email and he was saying it probably should be in rr sources
.