STAPREF(1)
๐ STAPREF(1) ๐
okay bestie, welcome to stapref, aka the systemtap language reference โ this is your one-stop glow-up guide for the whole systemtap scripting language, from the General Commands Manual section of your local man pages. pull up a chair, grab a boba, and let's get into it ๐งโจ
โจ SYNOPSIS โจ
stapref
๐ธ DESCRIPTION ๐ธ
it's the reference for the systemtap scripting language. that's it, that's the description. the whole language, right here, no cap ๐
๐ LANGUAGE ๐
๐ Keywords
your reserved-word royalty, do not use these as names or they will absolutely call you out:
breakcontinuedeleteelseexitforeachforfunctionglobalprivateifinnextprobereturntry/catchwhile
๐งฎ Data Types and Operators
Integers
var1 = 5global var2 = 10
Strings
var1 = "string1"global var2 = "string2"
Associative Arrays
global array1[]global array2[SIZE]array[index] = 5
Context Variables
$var$var$โ this one is the pretty printed string form, she's dressed up ๐
Binary numeric operators
* / % + - << >> >>> & ^ | && ||
Binary string operators
.โ that's string concatenation, gluing strings together like besties holding hands ๐ซถ
Numeric assignment operators
= += -= *= /= %= >>= <<= &= ^= |=
String assignment operators
= .=
Unary numeric operators
+ - ! ~ ++ --
Numeric & string comparison operators
< > <= >= == !=
Regular expression matching operators
=~ !~
Ternary operator
cond ? exp1 : exp2
Grouping operator
( expression )
Array operators
array[index]โ that's the array read/write right there[index] in array
Aggregation operator
var <<< value
๐ Statements
Jump Statements
continuebreaknextโ early return from a probe, she leaves the party early, iconicreturn expressionโ from a functiontry statement catch (message) statement
Selection Statements
if (expression) statementelse statement
Iteration Statements
foreach (variable in array) statementforeach ([var1,var2,...] in array) statementfor (expression; expression; expression) statementwhile (expression) statement
Declaration Statements
function name (variable : type, ...) { statement }function name : type (variable : type, ...) { statement }function name : type (variable : type, ...) %{ c_statement %}probe probepoint { statement }probe label = probepoint { statement }
๐ค Lexical Structure
Comments
# ... comment// ... comment/* ... comment ... */
Preprocessor
%( expression %? true_tokens %: false_tokens %)@define label (variable, ...) %{ statement %}
๐ ๏ธ Builtin Functions
Aggregation Builtin Functions
@avg (variable)@count (variable)@hist_linear (variable, N, N, N)@hist_log (variable)@max (variable)@min (variable)@sum (variable)
Output Builtin Functions
print (variable)printf (format:string, variable, ...)โ where format is of the form:%[flags][width][.precision][length]specifierprintd (delimiter:string, variable, ...)printdln (delimiter:string, variable, ...)println ()sprint:string (variable)sprintf:string (format:string, variable, ...)
Variable Access Builtin Functions
@var ("varname[@src/FILE.c]"[, "module"])โ static or global@cast (variable, "type_name"[, "module"])@defined (variable)@probewrite (variable)
๐ฏ Probepoints
some of the more commonly used probepoints:
kernel.function(PATTERN) kernel.function(PATTERN).callkernel.function(PATTERN).returnkernel.FUNCTION (PATTERN).return.maxactive(VALUE)kernel.FUNCTION (PATTERN).inlinekernel.FUNCTION (PATTERN).label(LPATTERN)module(MPATTERN).FUNCTION (PATTERN)module(MPATTERN).FUNCTION (PATTERN).callmodule(MPATTERN).FUNCTION (PATTERN).return.maxactive(VALUE)module(MPATTERN).FUNCTION (PATTERN).inlinekernel.statement(PATTERN)kernel.statement(ADDRESS).absolutemodule(MPATTERN).statement(PATTERN)kprobe.FUNCTION (FUNCTION)kprobe.FUNCTION (FUNCTION).returnkprobe.module(NAME).FUNCTION (FUNCTION)kprobe.module(NAME).FUNCTION (FUNCTION).returnkprobe.statement(ADDRESS).absoluteprocess.begin process("PATH").beginprocess(PID).begin process.thread.beginprocess("PATH").thread.beginprocess(PID).thread.beginprocess.endprocess("PATH").endprocess(PID).endprocess.thread.endprocess("PATH").thread.endprocess(PID).thread.endprocess("PATH").syscallprocess(PID).syscallprocess.syscall.returnprocess("PATH").syscall.returnprocess(PID).syscall.returnprocess("PATH").FUNCTION ("NAME")process("PATH").statement("*@FILE.c:123")process("PATH").FUNCTION ("*").returnprocess("PATH").FUNCTION ("myfun").label("foo")process("PATH").mark("LABEL")java("PNAME").class("CLASSNAME").method("PATTERN")java("PNAME").class("CLASSNAME").method("PATTERN").returnjava(PID).class("CLASSNAME").method("PATTERN")java(PID).class("CLASSNAME").method("PATTERN").returnpython3.module("MODULENAME").function("PATTERN")python3.module("MODULENAME").function("PATTERN").return
๐ง Tapset Functions
some of the more commonly used tapset functions:
addr:long ()backtrace:string ()caller:string ()caller_addr:long ()cmdline_arg:string (N:long)cmdline_args:string (N:long,m:long,delim:string)cmdline_str:string ()env_var:string (name:string)execname:string ()int_arg:long (N:long)isinstr:long(s1:string,s2:string)long_arg:long (N:long)modname:string ()module_name:string ()pid:long ()pn:string ()pointer_arg:string (N:long)pp:string ()print_backtrace ()probefunc:string ()register:long(name:string)str_replace:string(prnt_str:string,srch_str:string,rplc_str:string)stringat:long(str:string,pos:long)strlen:long(str:string)strtol:long(str:string,base:long)substr:string(str:string,start:long,length:long)user_long:long(addr:long)user_string:string(addr:long)
๐ SEE ALSO ๐
๐ BUGS ๐
found a bug? use the Bugzilla link of the project web page, or slide into our mailing list:
http://sourceware.org/systemtap/,<systemtap@sourceware.org>
ngl if you got this far you're lowkey a systemtap legend already. go write some probes, bestie ๐ซถ
and that's the whole page, babes โ this is stapref(1) from the General Commands Manual section, and the footer's just that same stapref(1) name stamped at the bottom like a little signature. no date, no version drama, just vibes. periodt ๐
โจ
๐ฆ where this page comes from
- arch rolling: systemtap 5.6-1 ยท GPL-2.0-or-later
- centos-stream 10: systemtap-client 5.6-3.el10 ยท GPL-2.0-or-later AND GPL-2.0-only AND BSD-3-Clause AND LGPL-2.1-only AND GFDL-1.2-or-later AND BSD-2-Clause
- centos-stream 9: systemtap-client 5.6-3.el9 ยท GPL-2.0-or-later AND GPL-2.0-only AND BSD-3-Clause AND LGPL-2.1-only AND GFDL-1.2-or-later AND BSD-2-Clause
- fedora 43: systemtap-client 5.6-1.fc43 ยท GPL-2.0-or-later AND GPL-2.0-only AND BSD-3-Clause AND LGPL-2.1-only AND GFDL-1.2-or-later AND BSD-2-Clause
- fedora 44: systemtap-client 5.6-1.fc44 ยท GPL-2.0-or-later AND GPL-2.0-only AND BSD-3-Clause AND LGPL-2.1-only AND GFDL-1.2-or-later AND BSD-2-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms