The build script produced the "vendor release" shape:
objcopy --only-keep-debug bin/03_hot_function bin/03_hot_function.debug
strip -o bin/03_hot_function.stripped bin/03_hot_function
objcopy --add-gnu-debuglink=bin/03_hot_function.debug bin/03_hot_function.stripped
$ perf buildid-cache -r ./bin/03_hot_function.stripped # see the NOTE below
$ mv bin/03_hot_function.debug /tmp/ # pretend we don't have it
$ ../tools/pin.sh -q perf record -o /tmp/03s.data ./bin/03_hot_function.stripped >/dev/null 2>&1
$ perf report -i /tmp/03s.data --stdio --no-children 2>/dev/null | grep -v '^#' | grep -v '^$' | head -3
what it printed on the machine that wrote this lab
16.26% 03_hot_function 03_hot_function.stripped [.] 0x0000000000000868
10.30% 03_hot_function 03_hot_function.stripped [.] 0x0000000000000855
9.71% 03_hot_function 03_hot_function.stripped [.] 0x0000000000000876
No names, only file offsets. This is what a release build from a vendor
looks like. Now put the debug file back where the .gnu_debuglink says:
$ readelf -p .gnu_debuglink ./bin/03_hot_function.stripped | grep -o '03_hot_function.debug'
what it printed on the machine that wrote this lab
03_hot_function.debug
$ mv /tmp/03_hot_function.debug bin/ && perf buildid-cache -r ./bin/03_hot_function.stripped
$ perf report -i /tmp/03s.data --stdio --no-children 2>/dev/null | grep -v '^#' | grep -v '^$' | head -3
what it printed on the machine that wrote this lab
86.31% 03_hot_function 03_hot_function.stripped [.] main
4.04% 03_hot_function libc.so.6 [.] __printf_buffer
2.51% 03_hot_function libc.so.6 [.] __printf_buffer_write
Same perf.data, names back. perf (and gdb) look for the debuglink file
next to the binary, in <dir>/.debug/, in /usr/lib/debug/<path>, and via
debuginfod. `perf buildid-cache -a file.debug` registers one explicitly.
NOTE (the thing that bit this lab): `perf record` COPIES every binary it
samples into ~/.debug/ keyed by build-id, and `strip` preserves the
build-id. So after profiling the unstripped binary once, the stripped
one "had symbols" for free from the cache. `perf buildid-cache -l` lists
it, `-r` forgets it. On a foreign machine that cache is empty.