1STAPREF(1)                  General Commands Manual                 STAPREF(1)
2
3
4

NAME

6       stapref - systemtap language reference
7
8
9

SYNOPSIS

11       stapref
12
13

DESCRIPTION

15       The reference for the systemtap scripting language.
16
17

LANGUAGE

19       Keywords
20break
21continue
22delete
23else
24exit
25foreach
26for
27function
28global
29private
30if
31in
32next
33probe
34return
35try/catch
36while
37
38
39       Data Types and Operators
40              Integers
41              • var1 = 5
42global var2 = 10
43
44              Strings
45              • var1 = "string1"
46global var2 = "string2"
47
48              Associative Arrays
49global array1[]
50global array2[SIZE]
51              • array[index] = 5
52
53              Context Variables
54$var
55$var$  (pretty printed string form)
56
57              Binary numeric operators
58* / % + - << >> >>> & ^ | && ||
59
60              Binary string operators
61. (string concatenation)
62
63              Numeric assignment operators
64= += -= *= /= %= >>= <<= &= ^= |=
65
66              String assignment operators
67= .=
68
69              Unary numeric operators
70+ - ! ~ ++ --
71
72              Numeric & string comparison operators
73< > <= >= == !=
74
75              Regular expression matching operators
76=~ !~
77
78              Ternary operator
79              • cond ? exp1 : exp2
80
81              Grouping operator
82( expression )
83
84              Array operators
85              • array[index] (array read/write)
86              • [index] in array
87
88              Aggregation operator
89              • var <<< value
90
91
92       Statements
93              Jump Statements
94continue
95break
96next  (early return from a probe)
97return expression (from a function)
98try statement catch (message) statement
99
100              Selection Statements
101if (expression) statement
102else statement
103
104              Iteration Statements
105foreach (variable in array) statement
106foreach ([var1,var2,...] in array) statement
107for (expression; expression; expression) statement
108while (expression) statement
109
110              Declaration Statements
111function name (variable : type, ...) { statement }
112function name : type (variable : type, ...) { statement }
113function name : type (variable : type, ...) %{ c_statement %}
114probe probepoint { statement }
115probe label = probepoint { statement }
116
117
118       Lexical Structure
119              Comments
120# ... comment
121// ... comment
122/* ... comment ... */
123
124              Preprocessor
125%( expression %? true_tokens %: false_tokens %)
126@define label (variable, ...) %{ statement %}
127
128
129       Builtin Functions
130              Aggregation Builtin Functions
131@avg (variable)
132@count (variable)
133@hist_linear (variable, N, N, N)
134@hist_log (variable)
135@max (variable)
136@min (variable)
137@sum (variable)
138
139              Output Builtin Functions
140print (variable)
141printf (format:string, variable, ...)
142                where format is of the form: %[flags][width][.precision][length]specifier
143printd (delimiter:string, variable, ...)
144printdln (delimiter:string, variable, ...)
145println ()
146sprint:string (variable)
147sprintf:string (format:string, variable, ...)
148
149              Variable Access Builtin Functions
150@var ("varname[@src/FILE.c]"[, "module"]) (static or global)
151@cast (variable, "type_name"[, "module"])
152@defined (variable)
153@probewrite (variable)
154
155
156       Probepoints
157              Some of the more commonly used probepoints
158              • kernel.function(PATTERN) kernel.function(PATTERN).call
159              • kernel.function(PATTERN).return
160              • kernel.FUNCTION (PATTERN).return.maxactive(VALUE)
161              • kernel.FUNCTION (PATTERN).inline
162              • kernel.FUNCTION (PATTERN).label(LPATTERN)
163              • module(MPATTERN).FUNCTION (PATTERN)
164              • module(MPATTERN).FUNCTION (PATTERN).call
165              • module(MPATTERN).FUNCTION (PATTERN).return.maxactive(VALUE)
166              • module(MPATTERN).FUNCTION (PATTERN).inline
167              • kernel.statement(PATTERN)
168              • kernel.statement(ADDRESS).absolute
169              • module(MPATTERN).statement(PATTERN)
170              • kprobe.FUNCTION (FUNCTION)
171              • kprobe.FUNCTION (FUNCTION).return
172              • kprobe.module(NAME).FUNCTION (FUNCTION)
173              • kprobe.module(NAME).FUNCTION (FUNCTION).return
174              • kprobe.statement(ADDRESS).absolute
175              • process.begin process("PATH").begin
176              • process(PID).begin process.thread.begin
177              • process("PATH").thread.begin
178              • process(PID).thread.begin
179              • process.end
180              • process("PATH").end
181              • process(PID).end
182              • process.thread.end
183              • process("PATH").thread.end
184              • process(PID).thread.end
185              • process("PATH").syscall
186              • process(PID).syscall
187              • process.syscall.return
188              • process("PATH").syscall.return
189              • process(PID).syscall.return
190              • process("PATH").FUNCTION ("NAME")
191              • process("PATH").statement("*@FILE.c:123")
192              • process("PATH").FUNCTION ("*").return
193              • process("PATH").FUNCTION ("myfun").label("foo")
194              • process("PATH").mark("LABEL")
195              • java("PNAME").class("CLASSNAME").method("PATTERN")
196              • java("PNAME").class("CLASSNAME").method("PATTERN").return
197              • java(PID).class("CLASSNAME").method("PATTERN")
198              • java(PID).class("CLASSNAME").method("PATTERN").return
199              • python2.module("MODULENAME").function("PATTERN")
200              • python2.module("MODULENAME").function("PATTERN").return
201              • python3.module("MODULENAME").function("PATTERN")
202              • python3.module("MODULENAME").function("PATTERN").return
203
204
205       Tapset Functions
206              Some of the more commonly used tapset functions
207              • addr:long ()
208              • backtrace:string ()
209              • caller:string ()
210              • caller_addr:long ()
211              • cmdline_arg:string (N:long)
212              • cmdline_args:string (N:long,m:long,delim:string)
213              • cmdline_str:string ()
214              • env_var:string (name:string)
215              • execname:string ()
216              • int_arg:long (N:long)
217              • isinstr:long(s1:string,s2:string)
218              • long_arg:long (N:long)
219              • modname:string ()
220              • module_name:string ()
221              • pid:long ()
222              • pn:string ()
223              • pointer_arg:string (N:long)
224              • pp:string ()
225              • print_backtrace ()
226              • probefunc:string ()
227              • register:long(name:string)
228              • str_replace:string(prnt_str:string,srch_str:string,rplc_str:string)
229              • stringat:long(str:string,pos:long)
230              • strlen:long(str:string)
231              • strtol:long(str:string,base:long)
232              • substr:string(str:string,start:long,length:long)
233              • user_long:long(addr:long)
234              • user_string:string(addr:long)
235
236
237

SEE ALSO

239       stap(1)
240
241

BUGS

243       Use  the  Bugzilla  link  of  the project web page or our mailing list.
244       http://sourceware.org/systemtap/,<systemtap@sourceware.org>.
245
246
247
248                                                                    STAPREF(1)
Impressum