build: Fix debug prefix map for generated source files #34468

pull BharathC0 wants to merge 1 commits into bitcoin:master from BharathC0:build-fix-bharath changing 1 files +1 −1
  1. BharathC0 commented at 8:48 am on January 31, 2026: none

    This PR fixes an issue where debug paths were inconsistent for generated files residing in the build tree. #34414

    Currently, the debug prefix map is restricted to ${DISTSRC}/src=.. This configuration fails to correctly map generated files that exist outside of the src directory (e.g., Cap’n Proto definitions), resulting in inconsistent file paths during debugging.

    Changes:

    • Updated HOST_CFLAGS in contrib/guix/libexec/build.sh to map the entire ${DISTSRC} to . instead of restricting it to ${DISTSRC}/src.

    This ensures all source files, including generated ones, have correct relative paths in the debug information.

  2. build: Fix debug prefix map
    Update HOST_CFLAGS to map the entire DISTSRC to current dir.
    1613b1d83f
  3. DrahtBot added the label Build system on Jan 31, 2026
  4. DrahtBot commented at 8:48 am on January 31, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  5. BharathC0 commented at 9:05 am on January 31, 2026: none
    @maflcko please review
  6. maflcko commented at 9:06 am on January 31, 2026: member
    Was this LLM generated? What are the steps to test this? What is the output before and after the changes here?
  7. BharathC0 commented at 9:16 am on January 31, 2026: none

    @maflcko I verified the PR description manually to be concise and follow the standard format. The code change itself is a direct application of the fix suggested by @hebasto in issue #34281, which I verified.

    1. Steps to Test: Since this is a build system change affecting debug symbols, it requires a Guix build:
    2. Run the Guix build: ./contrib/guix/guix-build
    3. Inspect the resulting binary with GDB: gdb <path_to_binary>
    4. Check the source path mapping for a generated file using info source.

    (Before vs. After):**

    • Before: The debug paths for generated files residing in the build tree (outside /src) were resolving to absolute build-server paths (e.g., /distsrc-base/...). This breaks source mapping on developer machines since those paths don’t exist locally.
    • After: By remapping ${DISTSRC}=. (instead of just ${DISTSRC}/src=.), the paths correctly resolve to relative paths (./...). This ensures the debugger can find the source files regardless of whether they are in src or the build tree.
  8. maflcko commented at 9:25 am on January 31, 2026: member
    Thx, but you’ll have to provide the relevant terminal output of your testing. Once before the change, and once after the change.
  9. BharathC0 commented at 9:40 am on January 31, 2026: none

    @maflcko I realized that running a full deterministic Guix build is resource-intensive and time-consuming for a single flag change. However, I have verified the fix using a Minimal Reproduction Test locally.

    I created a unused C++ file residing in a generated/ directory (simulating files outside src/ but inside the build tree) and compiled it with both the old and new flags using clang and dwarfdump.

    Here is the terminal output of the test:

    1. Test Setup: File location: /tmp/bitcoin_test/build/generated/test_gen.cpp (Outside src)

    2. OLD Flag Result (Current Master): Flag used: -fdebug-prefix-map=$PWD/src=. Result: Failed to map. Path remains absolute.

    0$ clang++ -g -c "$FILE_PATH" -fdebug-prefix-map=$PWD/src=. -o old.o
    1$ dwarfdump old.o | grep "DW_AT_name"
    2> DW_AT_name        ("/tmp/bitcoin_test/build/generated/test_gen.cpp")
    
  10. fanquake commented at 10:14 am on January 31, 2026: member

    I realized that running a full deterministic Guix build is resource-intensive and time-consuming for a single flag change.

    Thanks, however that is what you’ll need to do. Ideally you’ll build once on a x86_64 host, and once on an aarch64 host, to ensure that builds remain determinisitic, across build architecture.

    I have verified the fix using a Minimal Reproduction Test locally.

    I don’t think running some code on your macbook, using a different build system, compiler and compiler flags, is enough to verify flags being applied to Linux targets, using a different build system, compiler and compiler flags.

  11. maflcko added the label DrahtBot Guix build requested on Feb 2, 2026
  12. DrahtBot commented at 0:42 am on February 6, 2026: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit 9f8764c814ead48d45b3822dfcc4cc2b3bda80d6(master) commit 4a96104cc4db815cb902bae30fef0445e1885cb2(pull/34468/merge)
    *-aarch64-linux-gnu-debug.tar.gz 2e3ca053bdb9480b... a74d14af55be6b7d...
    *-aarch64-linux-gnu.tar.gz c12fbfe15a5b9e2d... f35ceb55e0822edd...
    *-arm-linux-gnueabihf-debug.tar.gz 4e9f1d9fe249241e... 61d908d32ad2d7f1...
    *-arm-linux-gnueabihf.tar.gz 99e2e57912ce5eaf... 299c4aa3d500c9e7...
    *-arm64-apple-darwin-codesigning.tar.gz fc2e67047a946f7c... fefd9a0bca89764e...
    *-arm64-apple-darwin-unsigned.tar.gz a653c5e2d7c86935... 3c2f1c4b92e21fc1...
    *-arm64-apple-darwin-unsigned.zip 5fe1ea8da4850fbf... 44c6234324c1a534...
    *-powerpc64-linux-gnu-debug.tar.gz aa4f2fba2d04d740... 897b72d157db2293...
    *-powerpc64-linux-gnu.tar.gz 2dc700077ab284ec... f5b0ae8f04da2391...
    *-riscv64-linux-gnu-debug.tar.gz 91fedf340afadc6e... 97ac4b5df13c45ca...
    *-riscv64-linux-gnu.tar.gz 62d637260a441e49... 472a9ef240819535...
    *-win64-codesigning.tar.gz 15dfdc4625ca487b... 482c318599056132...
    *-win64-debug.zip 7f97f0fd322713c7... 2b040d2dc16c912e...
    *-win64-setup-unsigned.exe 9df3e242b17f2de0... bc04a0283f767791...
    *-win64-unsigned.zip 69e3ced2cff6411b... 317ce60fcc1218e0...
    *-x86_64-apple-darwin-codesigning.tar.gz e0af17b968f8b79b... 934255e6775bf3e6...
    *-x86_64-apple-darwin-unsigned.tar.gz 17fb694b2c8674c0... 7afa07a7ee387813...
    *-x86_64-apple-darwin-unsigned.zip 22633c1e137ffbc4... 2602613e8a423b09...
    *-x86_64-linux-gnu-debug.tar.gz 5560645b8618ec23... 8851b8b1506b2ec7...
    *-x86_64-linux-gnu.tar.gz 49e7dee3d4097a23... a7a514dcb98cc2ae...
    *.tar.gz 78c81a3d5834192b... 755cdea7b6240304...
    SHA256SUMS.part f07c8b2ce3dcea04... 7b7316c5d9b036ee...
    guix_build.log 438e893356d8299e... 37b92b7588501c2b...
    guix_build.log.diff 6f61953e4876c0be...
  13. DrahtBot removed the label DrahtBot Guix build requested on Feb 6, 2026
  14. maflcko commented at 6:23 am on February 6, 2026: member
    Are you still working on this, or can it be closed?
  15. fanquake commented at 10:48 am on February 9, 2026: member
    Closing for now.
  16. fanquake closed this on Feb 9, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-02-18 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me