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
20              · break
21              · continue
22              · delete
23              · else
24              · exit
25              · foreach
26              · for
27              · function
28              · global
29              · private
30              · if
31              · in
32              · next
33              · probe
34              · return
35              · try/catch
36              · while
37
38
39       Data Types and Operators
40              Integers
41              · var1 = 5
42              · global var2 = 10
43
44              Strings
45              · var1 = "string1"
46              · global var2 = "string2"
47
48              Associative Arrays
49              · global array1[]
50              · global 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
94              · continue
95              · break
96              · next  (early return from a probe)
97              · return expression (from a function)
98              · try statement catch (message) statement
99
100              Selection Statements
101              · if (expression) statement
102              · else statement
103
104              Iteration Statements
105              · foreach (variable in array) statement
106              · foreach ([var1,var2,...] in array) statement
107              · for (expression; expression; expression) statement
108              · while (expression) statement
109
110              Declaration Statements
111              · function name (variable : type, ...) { statement }
112              · function name : type (variable : type, ...) { statement }
113              · function name : type (variable : type, ...) %{ c_statement %}
114              · probe probepoint { statement }
115              · probe 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
140              · print (variable)
141              · printf (format:string, variable, ...)
142                where format is of the form: %[flags][width][.precision][length]specifier
143              · printd (delimiter:string, variable, ...)
144              · printdln (delimiter:string, variable, ...)
145              · println ()
146              · sprint:string (variable)
147              · sprintf:string (format:string, variable, ...)
148
149              Variable Access Builtin Functions
150              · @cast (variable, "type_name"[, "module"])
151              · @defined (variable)
152
153
154       Probepoints
155              Some of the more commonly used probepoints
156              · kernel.function(PATTERN) kernel.function(PATTERN).call
157              · kernel.function(PATTERN).return
158              · kernel.FUNCTION (PATTERN).return.maxactive(VALUE)
159              · kernel.FUNCTION (PATTERN).inline
160              · kernel.FUNCTION (PATTERN).label(LPATTERN)
161              · module(MPATTERN).FUNCTION (PATTERN)
162              · module(MPATTERN).FUNCTION (PATTERN).call
163              · module(MPATTERN).FUNCTION (PATTERN).return.maxactive(VALUE)
164              · module(MPATTERN).FUNCTION (PATTERN).inline
165              · kernel.statement(PATTERN)
166              · kernel.statement(ADDRESS).absolute
167              · module(MPATTERN).statement(PATTERN)
168              · kprobe.FUNCTION (FUNCTION)
169              · kprobe.FUNCTION (FUNCTION).return
170              · kprobe.module(NAME).FUNCTION (FUNCTION)
171              · kprobe.module(NAME).FUNCTION (FUNCTION).return
172              · kprobe.statement(ADDRESS).absolute
173              · process.begin process("PATH").begin
174              · process(PID).begin process.thread.begin
175              · process("PATH").thread.begin
176              · process(PID).thread.begin
177              · process.end
178              · process("PATH").end
179              · process(PID).end
180              · process.thread.end
181              · process("PATH").thread.end
182              · process(PID).thread.end
183              · process("PATH").syscall
184              · process(PID).syscall
185              · process.syscall.return
186              · process("PATH").syscall.return
187              · process(PID).syscall.return
188              · process("PATH").FUNCTION ("NAME")
189              · process("PATH").statement("*@FILE.c:123")
190              · process("PATH").FUNCTION ("*").return
191              · process("PATH").FUNCTION ("myfun").label("foo")
192              · process("PATH").mark("LABEL")
193              · java("PNAME").class("CLASSNAME").method("PATTERN")
194              · java("PNAME").class("CLASSNAME").method("PATTERN").return
195              · java(PID).class("CLASSNAME").method("PATTERN")
196              · java(PID).class("CLASSNAME").method("PATTERN").return
197              · python2.module("MODULENAME").function("PATTERN")
198              · python2.module("MODULENAME").function("PATTERN").return
199              · python3.module("MODULENAME").function("PATTERN")
200              · python3.module("MODULENAME").function("PATTERN").return
201
202
203       Tapset Functions
204              Some of the more commonly used tapset functions
205              · addr:long ()
206              · backtrace:string ()
207              · caller:string ()
208              · caller_addr:long ()
209              · cmdline_arg:string (N:long)
210              · cmdline_args:string (N:long,m:long,delim:string)
211              · cmdline_str:string ()
212              · env_var:string (name:string)
213              · execname:string ()
214              · int_arg:long (N:long)
215              · isinstr:long(s1:string,s2:string)
216              · long_arg:long (N:long)
217              · modname:string ()
218              · module_name:string ()
219              · pid:long ()
220              · pn:string ()
221              · pointer_arg:string (N:long)
222              · pp:string ()
223              · print_backtrace ()
224              · probefunc:string ()
225              · register:long(name:string)
226              · str_replace:string(prnt_str:string,srch_str:string,rplc_str:string)
227              · stringat:long(str:string,pos:long)
228              · strlen:long(str:string)
229              · strtol:long(str:string,base:long)
230              · substr:string(str:string,start:long,length:long)
231              · user_long:long(addr:long)
232              · user_string:string(addr:long)
233
234
235

SEE ALSO

237       stap(1)
238
239

BUGS

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