systemtab Grammar and Usage

systemtab kernel detection and debugging tools available under Linux, you can customize the function you want to test, debug print output.

Compile and run

Compiled executable modules:
STAP systemtab_script -m Module
systemtab_script: systemtab write their own script
module: ko generated kernel module name

After compilation, the script will be written compiled into the kernel Ko

Execute the generated kernel Ko:
staprun module.ko

grammar

#!/usr/bin/env stap

probe timer.ms(3000){
		printf("Hello!\n");
}

Above implements an output once every 3s hello script
probe statement indicates that this is a detection point, will perform the appropriate treatment after detecting condition is satisfied.
Commonly used detection point:
the Timer: timer, time will meet the trigger. As the example above is triggered once every 3s
kernel.function ( "FUNCTION"): Specifies the function detects the specified function triggers. If you specify kernel.function ( "sys_ *") is detected by the system call function executes

Released five original articles · won praise 0 · Views 75

Guess you like

Origin blog.csdn.net/N07ME/article/details/104747096