gentoo 上安裝 systemtap
emerge -avt dev-util/systemtap
emerge的輸出會提示你需要重新編譯kernel打開相應的核心支援,如debuginfo, kprobe。
可惜的是跑不了,systemtap-2.4在linux-3.18上有個bug。
解決的方法是手工編譯最新的systemtap,很簡單:
git clone git://sourceware.org/git/systemtap.git
./configure --prefix=~/tools
make -j8 && make install
安裝systemtap-mode
git clone https://github.com/ruediger/systemtap-mode.git 把systemtap-mode.el 放到emacs的加載路徑下面
(require 'systemtap-mode)
開始愉快的編寫systemtap了
注意,如果要在emacs中執行腳本,emacs需要有root權限。
systemtap-execute-script