尝试在 CentOS 7.7 上跟踪探测器时无法在 'perf report' 中看到内核符号

Can't see kernel symbols in 'perf report' when trying to trace a probe on CentOS 7.7

我正在尝试查看哪些内核代码调用了 CentOS 7.7 (x86-64) 上的特定函数。我试过这个:

perf probe -a vsnprintf
perf record -e probe:vsnprintf -aR sleep 10

然后,当我尝试时:

perf report --stdio

我在输出中只看到一堆十六进制数字,而不是函数名称:

# Total Lost Samples: 0
#
# Samples: 331  of event 'probe:vsnprintf'
# Event count (approx.): 331
#
# Children      Self  Trace output      
# ........  ........  ..................
#
   100.00%   100.00%  (ffffffffaf58c750)
            |          
            |--56.19%--0
            |          __GI___libc_read
            |          0xffffffffaf98bede
            |          0xffffffffaf4493bf
            |          0xffffffffaf4484ff
            |          0xffffffffaf4c09b0

内核版本(我运行在KVM上的虚拟机中):

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

我选择了 vsnprintf,因为它经常出现在 'perf top' 中(内核符号 - 我在那里正确地看到了符号)。

有没有办法查看实际的函数名称?

RHEL 7.7 中的 Perf 有一个错误,阻止它报告内核符号:https://access.redhat.com/solutions/4797281

我强烈怀疑 CentOS 7.7 有完全相同的错误。按照上页中建议的解决方法,我将 perf 降级到 CentOS 7.6 中的版本,它似乎可以工作:

# give access to packages from 7.6
yum-config-manager --add-repo=http://vault.centos.org/centos/7.6.1810/updates/x86_64/

# reinstall older perf
yum remove perf
yum install perf-3.10.0-957.1.3.el7

# optional: disable the vault repo
yum-config-manager --disable vault.centos.org_centos_7.6.1810_updates_x86_64_

# test that it now works
perf record -a -g -- sleep 3
perf report --stdio
# looks good!