因为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
为13.04添加apt-get源:
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ raring main restricted universe multiverse
deb http://ddebs.ubuntu.com/ raring-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ raring-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ raring-proposed main restricted universe multiverse
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01
sudo apt-get update
这个快800MB了,有点大
sudo apt-get install linux-image-$(uname -r)-dbgsym
sudo apt-get install -y systemtap
查看systemtap安装是否成功:
stap -l 'module("*").function("*")'
慢且多
或者
sudo stap -e 'probe begin{printf("hello"); exit();}'
此外还要安装systemap-sdt-dev
sudo apt-get install -y systemtap-sdt-dev
不然configure会出现错误