SystemTap, linuxsystemtap
Install
Sudo apt-get install build-essential
Sudo apt-get install elfutils
Sudo apt-get install libdw-dev
Wget https://sourceware.org/systemtap/ftp/releases/systemtap-2.4.tar.gz
Tar-xzvf systemtap-2.4.tar.gz
Cd systemtap-2.4
./Configure
Sudo make
Sudo make install
Test statement
Sudo stap -- all-modules-ve 'probe in {log ("hello world") exit ()}'
Sudo stap-ve 'probe begin {log ("hello world") exit ()}'
Sudo stap-ve 'probe kernel. function ("sys_open") {log ("hello world") exit ()}'
Sudo stap-ve 'probe module ("libiscsi"). function ("iscsi_queuecommand") {log ("hello world") exit ()}'
Print stack
Print_backtrace-- All-modules: loads all modules and displays stack information.
Use SystemTap on Ubuntu
Http://www.ningoo.net/html/2010/use_systemtap_on_ubuntu.html
Ubuntu + systemtap for Linux kernel and user space development and testing
Http://blog.csdn.net/sailor_8318/article/details/25076745
SystemTap installation Build-id mismatch on Ubuntu 12.04
Http://www.it165.net/ OS /html/201310/6486.html
Use systemtap to debug Linux Kernel
Http://blog.csdn.net/heli007/article/details/7187748
Reasons for using systemtap to locate ifconfig dropped data packets
Http://www.it165.net/ OS /html/201308/5944.html
Example
Https://sourceware.org/systemtap/wiki
Detailed explanation of System Language
Http://blog.csdn.net/linyt/article/details/5204841
#! /Usr/bin/env stap global host_no = 17 global channel = 0 global targetid = 0 global lunid = 15 # determine whether io is delivered to iscsiprobe module ("libiscsi "). function ("iscsi_queuecommand") {if ($ host! = 0 & $ SC! = 0) {if ($ host-> host_no = host_no & $ SC-> device-> channel = channel & $ SC-> device-> id = targetid & $ SC-> device-> lun = lunid) {printf ("================================ send scsi ============== ===========\ n ") printf ("tag = % d \ n", $ SC-> tag) printf ("serial_number = % lu \ n", $ SC-> serial_number) printf ("jiffies_at_alloc = % lu \ n", $ SC-> jiffies_at_alloc) print_backtrace () printf ("\ n") }} probe kernel. function ("do_sync _ Read ") {if ($ filp! = 0) {if ($ filp-> f_inode! = 0) {if ($ filp-> f_inode-> I _ino = 3978543828) {printf ("========================================== ======= do_sync_read \ n ")}}}} # determine whether I/O is correctly delivered to the probe module ("libiscsi") in iscsi "). statement ("iscsi_queuecommand@libiscsi.c: 1690") {if ($ host! = 0 & $ SC! = 0) {if ($ host-> host_no = host_no & $ SC-> device-> channel = channel & $ SC-> device-> id = targetid & $ SC-> device-> lun = lunid) {printf ("================================ cmd sended ====================== ===========\ n ") printf ("reason = % d \ n", $ reason) printf ("\ n") }}# determine whether IO returns probe module ("libiscsi "). function ("_ iscsi_put_task") {if ($ task! = 0) {if ($ task-> SC! = 0) {if ($ task-> SC-> device-> host-> host_no = host_no & $ task-> SC-> device-> channel = channel & $ task -> SC-> device-> id = targetid & $ task-> SC-> device-> lun = lunid) {printf ("************************* recv scsi ********* * ********** \ n ") printf ("tag = % d \ n", $ task-> SC-> tag) printf ("serial_number = % lu \ n", $ task-> SC-> serial_number) printf ("jiffies_at_alloc = % lu \ n", $ task-> SC-> jiffies_at_alloc) print_backtrace () printf ("\ n ")}}}}