ubuntu上安装systemtap
因为Ubuntu没有提供kernel debug symbols,systemtap安装后是不能直接在ubuntu上正常使用的。
有人提供了一个安装脚本
https://bitbucket.org/sentimental/poc_stap
为12.04添加apt-get源:
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ precise main restricted universe multiverse
deb http://ddebs.ubuntu.com/ precise-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ precise-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ precise-proposed main restricted universe multiverse
EOF
为12.10添加apt-get源:
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ quantal main restricted universe multiverse
deb http://ddebs.ubuntu.com/ quantal-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ quantal-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ quantal-proposed main restricted universe multiverse
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01
sudo apt-get update
sudo apt-get install -y systemtap
这个快800MB了,有点大
sudo apt-get install linux-image-$(uname -r)-dbgsym
查看systemtap安装是否成功:
stap -l 'module("*").function("*")'
慢且多
或者
sudo stap -e 'probe begin{printf("hello"); exit();}'