Fixes #34414.
Why
The Guix build scripts set -fdebug-prefix-map=${DISTSRC}/src=.. Generated sources (for example the capnp proxies) are in the build tree, outside ${DISTSRC}/src, so their debug info kept the absolute /distsrc-base/distsrc-<commit>-<host>/build/... path. Sources from src/ were relative. With two kinds of paths, it is hard to set up source path mapping in a debugger.
This maps ${DISTSRC} instead, in build_linux.sh, build_linux_gui.sh, build_win.sh and build_win_gui.sh. The macOS scripts do not set -fdebug-prefix-map, so this PR does not change them.
What changes in the debug paths
All source paths are now relative to the repository root:
| Before | After | |
|---|---|---|
Source in src/ |
./netaddress.cpp |
./src/netaddress.cpp |
| Generated source | /distsrc-base/distsrc-<commit>-<host>/build/src/ipc/capnp/init.capnp.proxy-client.c++ |
./build/src/ipc/capnp/init.capnp.proxy-client.c++ |
To find the sources in gdb, use the repository root as the source directory (directory /path/to/bitcoin) instead of src/.
How I checked
- Guix build of this change on an x86_64 build machine, for the six Linux and Windows hosts.
readelf --debug-dump=info,--debug-dump=rawlineand--debug-dump=stroflibexec/bitcoin-node.dbg(x86_64-linux-gnu): nodistsrcstring. Sources show as./src/..., generated capnp files as./build/src/....bitcoind.exe.dbgfrom the Windows debug zip: nodistsrcstring.- The only absolute paths left come from the Guix toolchain (glibc, libgcc). This change does not affect them.
I will post the Guix hashes for this commit in a comment. I do not have an aarch64 build machine at the moment, so a build from someone with one is welcome.