Symbols not showing up when running rust program

Was trying to test the performance of my rust program.

I compiled it with RUSTFLAGS=-g, and ran it with sudo perf record -g ../target/release/myprogram

However, most of the symbols are not found, and showing up as 0x00000000000001, with a shared object unknown.

Any way to get those symbols resolved? I am using FFI to call from some shared object as well, but those functions symbols are resolved properly in perf.

Using cargo 1.31.0-nightly, perf 4.18.15, Fedora 27

Thanks!

Did you enable debug symbols in the release profile? https://doc.rust-lang.org/cargo/reference/manifest.html#the-profile-sections

# Cargo.toml

[profile.release]
debug = true

perf record -g depends on frame pointers which rustc won’t emit by default. Build your program with debuginfo and use perf record --call-graph=dwarf instead.

@parasyte Yes. debug in the release profile was also enabled.
@sfackler Right, I did try recording with dwarf call-graph. However, I ran into segmentation faults while doing perf report. Some information about the dwarf segfault issue was also reported here.

I tried using perf on another machine I have with perf version 4.15.18. I can get the dwarf call graph report, even though the symbols are not too reader friendly. Most of the symbols are resolved, with a few exceptions.

As for now, this is good enough. Thanks for the help!

Sufficiently new versions of perf have rust symbol demangling support, but I’m not sure which release that was first added.