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