I want to profile an application compiled with debug symbols:
$ file ../../bin/linux-x86_64/simulator
../../bin/linux-x86_64/simulator: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=156bbd57d203d72f4226ed4ad0727bcf472f83ef, for GNU/Linux 3.2.0, with debug_info, not stripped
It runs inside a podman container. The container is a debian 11 and the host is an ubuntu 22.04. I have been able to use perf with it before but i must be forgetting some necessary configuration.
Outside the container i did:
sudo sysctl kernel.perf_event_paranoid=-1
Then to enter the container:
podman run --privileged --entrypoint=bash --network=host --rm -it -v ./st.cmd/:/opt/ad-sim-epics-ioc/iocBoot/iocsimulator/st.cmd -v /home/marco:/home/marco ghcr.io/cnpem/ad-sim-epics-ioc:v1.0.0
And finally to install perf:
apt-get update && apt-get install linux-perf
To get the profiler results:
perf record -g ./st.cmd # st.cmd is an interpreter with shebang poiting to ../../bin/linux-x86_64/simulator
At the first try, system will complain:
/usr/bin/perf: line 13: exec: perf_5.15: not found
But since i found several people claiming that its okay to copy or symbolically link perf:
ln -s /usr/bin/perf_5.10 /usr/bin/perf_5.15
Finally:
perf record -g ./st.cmd
(do things...)
^C
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.128 MB perf.data (2500 samples) ]
perf script -F +pid > script.txt
But absolutely no userspace function is shown, only kernel kallsyms:
I tried running the container with and without --privileged flag, tried perf record --call-graph dwarf, perf record --call-graph fp, and nothing. I vividly remember being able to see the functions just with perf record -g... what am I doing wrong?
Thanks in advance for anyone who helps this lost, desperate soul.

