[root@workstation2017 ~]# uname -r
1.安装程序
yum install systemtap systemtap-runtime
// 这个会被安装 systemtap-sdt-devel-3.0-7.el7.x86_64
2. //安装内核调试符号
自动安装
stap-prep://安装内核调试符号
kernel-debuginfo-common-`name -r`
kernel-debuginfo-`uname -r`
kernel-devel-`uname -r`
手动下载安装
kernel-debuginfo-common-`name -r`
kernel-debuginfo-`uname -r`
kernel-devel-`uname -r`
linux 内核源代码位置
[root@workstation2017 linux-3.10.0-514.el7.x86_64]# pwd
/usr/src/debug/kernel-3.10.0-514.el7/linux-3.10.0-514.el7.x86_64
测试:
[root@workstation2017 ~]# stap -v -e 'probe vfs.read {printf("read performed "); exit()}'
[root@workstation2017 ~]# stap -v -e 'probe vfs.read.return {printf("read performed "); exit()}'
[root@workstation2017 ~]# stap -L 'kernel.function("sys_open")'
kernel.function("SyS_open@fs/open.c:1041") $filename:long int $flags:long int $mode:long int
支持用护级别调试