Even when building with the default development profile (cargo build
), the generated debuginfo often only includes the last segment of paths to source files. This then affects the output of perf
, where it only gives me the bare filename in its perf script
output. How can I get the full filepaths to be emitted in the debuginfo?
For example, if I run
❯ eu-readelf -w target/debug/mybinary | rg parse.rs
The output looks like this (only a piece of it since it's very long):
decl_file (data1) parse.rs (16)
decl_file (data1) parse.rs (16)
call_file (data1) parse.rs (16)
decl_file (data1) parse.rs (18)
decl_file (data1) parse.rs (18)
decl_file (data1) parse.rs (18)
decl_file (data1) parse.rs (18)
decl_file (data1) parse.rs (18)
Or, if I instead grep for main.rs
, I get a bunch of results that are just main.rs
like above, although there are also a few paths like src/main.rs/@/
followed by a long string of arbitrary alphanumeric characters.
The fix turns out to be passing --full-source-path
to perf script
.