1. 安装systemtap
$ sudo apt-get install systemtap
$ sudo apt-get install systemtap-sdt-dev
2. 安装debuginfo:
wget http://www.domaigne.com/download/tools/get-dbgsym
chmod +x get-dbgsym
./get-dbgsym
3. 启动stap
$ stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'
hello world
注:centos系统上的安装方法:
yum install kernel-devel
yum --enablerepo=debug install kernel-debuginfo
yum install systemtap
如果上述debuginfo找不到,需要手动下载:http://debuginfo.centos.org/6/x86_64/kernel-debug-debuginfo-2.6.32-220.el6.x86_64.rpm