This is a standalone repro case for golang/go#40879
testdata
contains logic to build 2 executables,bad
andgood
.- They both have a CU DIE that uses DW_AT_ranges (to force this, I used a linker script to spread the code across 2 sections at different addresses)
bad
has a.rela.debug_ranges
section (it is linked with--emit-relocs
)
main.go
contains logic that prints the PC ranges of a binary.test.sh
will print the PC ranges using both the Go binary, andllvm-dwarfdump
, to highlight the differencemake
will compile all binaries and runtest.sh
on bothgood
andbad
, highlighting the difference.
Note: you need llvm
installed (for llvm-dwarfdump
). Alternatively you can change the test.sh script to use the regular dwarfdump
.