Debian體系,本人測試用機 Ubuntu 11.10linux
uname -r 查看本來的內核版本爲 3.0.0-12-generic測試
第一步:ui
安裝systemtap包debug
$ sudo apt-get install systemtap $ sudo apt-get install systemtap-sdt-dev
測試blog
stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'
不能正確輸出hello worldip
semantic error: libdwfl failure (missing x86_64 kernel/module debuginfo under '/lib/modules/3.0.0-12-generic/build'): No such file or directory while resolving probe point kernel.function("sys_open") semantic error: no probes found Pass 2: analysis failed. Try again with another '--vp 01' option.
報告錯誤大體意思爲找不到內核debuginfo 信息get
解決辦法:it
1.安裝帶debuginfo的內核io
#安裝編譯內核所須要的對應的依賴關係包 $ sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r) #下載內核鏡像 $ apt-get source linux-image-$(uname -r) $ cd linux-3.0.0 $ debian/rules clean #開始編譯內核,skipdbg爲false編譯不跳過帶debuginfo的選項 $ AUTOBUILD=1 fakeroot debian/rules binary-generic skipdbg=false #安裝3.0.0-32版本的內核 $ sudo dpkg -i ../linux-image-3.0.0-32-generic-dbgsym_3.0.0-32.51_i386.ddeb
筆者最初的內核版本爲3.0.0-12-generic,編譯帶debuginfo的內核安裝後對應升級到 3.0.0-32-generic編譯
2.安裝linux-headers
sudo apt-get install linux-headers-`uname -r`
3.重啓機器
stap -e 'probe kernel.function("sys_open") {log("hello world") exit()}'
正確輸出hello world表示安裝成功