Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Assure dwarf debug info stays correct in dist builds #124

Closed
drahnr opened this issue Dec 6, 2021 · 3 comments
Closed

Assure dwarf debug info stays correct in dist builds #124

drahnr opened this issue Dec 6, 2021 · 3 comments

Comments

@drahnr
Copy link
Contributor

drahnr commented Dec 6, 2021

With the recently landed PR #116 we have basic support.

One of the remaining questions, is the effect on debug info paths.

If they are intact, that's awesome! If not, well.. parsing the return object file and parsing the paths and manually remapping them by usage of i.e. gimli might be an option.

@montekki
Copy link
Contributor

AFAIU the only thing in DWARF pointing to compdir would be the DW_AT_comp_dir variable and it looks like --remap-path-prefix successfully modifies it.

In my case --remap-path-prefix /home/$USERNAME/=/tmp creates this info:

llvm-dwarfdump ./target/debug/ttt | head -n 20
./target/debug/ttt:     file format elf64-x86-64

.debug_info contents:
0x00000000: Compile Unit: length = 0x0000004c, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000050)

0x0000000b: DW_TAG_compile_unit
              DW_AT_producer    ("clang LLVM (rustc version 1.58.1 (db9d1b20b 2022-01-20))")
              DW_AT_language    (DW_LANG_Rust)
              DW_AT_name        ("src/main.rs")
              DW_AT_stmt_list   (0x00000000)
              DW_AT_comp_dir    ("/tmp/ttt")
              DW_AT_GNU_pubnames        (true)
              DW_AT_low_pc      (0x00000000000085d0)
              DW_AT_high_pc     (0x00000000000085d2)

0x0000002a:   DW_TAG_namespace
                DW_AT_name      ("core")

0x0000002f:     DW_TAG_namespace
                  DW_AT_name    ("hint")

@drahnr
Copy link
Contributor Author

drahnr commented Feb 22, 2022

That'd mean we could just modify the comp_dir on retrieval and modify that for local debug symbol resolution, or do we need to touch that at all?

@montekki
Copy link
Contributor

As soon as you command cachepot to do directory remapping as in #116 cachepot you will end up with the intended paths in DWARF as well. In other words you do not need to do anything extra atm.

@drahnr drahnr closed this as completed Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants