-
Notifications
You must be signed in to change notification settings - Fork 14k
Description
I recently discovered that the elfutils eu-addr2line doesn't resolve locations for Rust functions. It turns out that they are expecting .debug_aranges to be valid and complete, and even treat its absence as if there are no addresses covered at all. But rustc doesn't emit aranges with its debuginfo, or at least not by default.
If you see a .debug_aranges section in your rust binaries today, that's probably only from objects compiled by GCC, like jemalloc. Try eu-readelf -waranges to see what CUs and symbols are covered. Thus even when .debug_aranges does exist, it's not necessarily complete.
Clang doesn't emit aranges by default either, but it does have the -gdwarf-aranges option to do so. This turns into the LLVM option -generate-arange-section. So it turns out that Rust can have aranges too, using rustc -Cllvm-args=-generate-arange-section. Great!
It would be nice if this were the default though. The data is usually not very big, but it can let tools map an address to the right CU very quickly, reducing the slower DIE traversals.