1. First install systemtap:
Sudo apt-Get install systemtap
2. Install the debug info of Linux kernel
You can download the debug info package from http://ddebs.ubuntu.com/pool/main/l/linux/with kernelmodules. Refer to the release.
Another method is to recompile the kernel. The process is as follows:
(1) apt-Get install linux-source-2.6.38 download kernel source code
(2) go to the source code directory:
CD/usr/src/
Decompress the source package:
Bzip2-D linux-source-2.6.38.tar.bz2
Tar xvf linux-source-2.6.38.tar
(3) go to the source code directory and execute make menuconfig.
/Usr/src/The linux-source-2.6.38/linux-source-2.6.38 # Make menuconfig
Hostcc scripts/kconfig/CONF. o
Hostcc scripts/kconfig/kxgettext. o
* ** Unable to find the ncurses libraries or
* ** Required header files.
* ** 'Make menuconfig' requires the ncurses libraries.
***
* ** Install ncurses (ncurses-devel) and try again.
***
Make [1]: *** [scripts/kconfig/dochecklxdialog] Error 1
This is because the libncurses5-dev package is not installed, run the following command:
Apt-Get install libncurses5-dev
Try make menuconfig again and select the following compilation options (all are selected by default)
Kernel hacking
Kernel debugging
Compile the kernel with debug info
General setup
Kprobes
Run make; Make modules_install; make install
Run CP vmlinux/lib/modules/2.6.38/2.6.38-prep (from the perspective of a tutorial, but it is not necessary to do so)
Restart the system.
(4) install elfutils
Sudo apt-Get install elfutils
(5) run the following command. The correct return value indicates that systemtap is successfully installed.
# STAP-ve 'probe begin {log ("Hello World") Exit ()}'
# STAP-c df-e 'probe syscall. Open {If (target () = PID () log (name. "". argstr )}'
Refer:
Http://blog.chinaunix.net/space.php? Uid = 20589995 & Do = Blog & id = 1621748
Http://linux.chinaunix.net/docs/2006-12-15/3479.shtml