1STAPREF(1) General Commands Manual STAPREF(1)
2
3
4
6 stapref - systemtap language reference
7
8
9
11 stapref
12
13
15 The reference for the systemtap scripting language.
16
17
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 · @probewrite (variable)
153
154
155 Probepoints
156 Some of the more commonly used probepoints
157 · kernel.function(PATTERN) kernel.function(PATTERN).call
158 · kernel.function(PATTERN).return
159 · kernel.FUNCTION (PATTERN).return.maxactive(VALUE)
160 · kernel.FUNCTION (PATTERN).inline
161 · kernel.FUNCTION (PATTERN).label(LPATTERN)
162 · module(MPATTERN).FUNCTION (PATTERN)
163 · module(MPATTERN).FUNCTION (PATTERN).call
164 · module(MPATTERN).FUNCTION (PATTERN).return.maxactive(VALUE)
165 · module(MPATTERN).FUNCTION (PATTERN).inline
166 · kernel.statement(PATTERN)
167 · kernel.statement(ADDRESS).absolute
168 · module(MPATTERN).statement(PATTERN)
169 · kprobe.FUNCTION (FUNCTION)
170 · kprobe.FUNCTION (FUNCTION).return
171 · kprobe.module(NAME).FUNCTION (FUNCTION)
172 · kprobe.module(NAME).FUNCTION (FUNCTION).return
173 · kprobe.statement(ADDRESS).absolute
174 · process.begin process("PATH").begin
175 · process(PID).begin process.thread.begin
176 · process("PATH").thread.begin
177 · process(PID).thread.begin
178 · process.end
179 · process("PATH").end
180 · process(PID).end
181 · process.thread.end
182 · process("PATH").thread.end
183 · process(PID).thread.end
184 · process("PATH").syscall
185 · process(PID).syscall
186 · process.syscall.return
187 · process("PATH").syscall.return
188 · process(PID).syscall.return
189 · process("PATH").FUNCTION ("NAME")
190 · process("PATH").statement("*@FILE.c:123")
191 · process("PATH").FUNCTION ("*").return
192 · process("PATH").FUNCTION ("myfun").label("foo")
193 · process("PATH").mark("LABEL")
194 · java("PNAME").class("CLASSNAME").method("PATTERN")
195 · java("PNAME").class("CLASSNAME").method("PATTERN").return
196 · java(PID).class("CLASSNAME").method("PATTERN")
197 · java(PID).class("CLASSNAME").method("PATTERN").return
198 · python2.module("MODULENAME").function("PATTERN")
199 · python2.module("MODULENAME").function("PATTERN").return
200 · python3.module("MODULENAME").function("PATTERN")
201 · python3.module("MODULENAME").function("PATTERN").return
202
203
204 Tapset Functions
205 Some of the more commonly used tapset functions
206 · addr:long ()
207 · backtrace:string ()
208 · caller:string ()
209 · caller_addr:long ()
210 · cmdline_arg:string (N:long)
211 · cmdline_args:string (N:long,m:long,delim:string)
212 · cmdline_str:string ()
213 · env_var:string (name:string)
214 · execname:string ()
215 · int_arg:long (N:long)
216 · isinstr:long(s1:string,s2:string)
217 · long_arg:long (N:long)
218 · modname:string ()
219 · module_name:string ()
220 · pid:long ()
221 · pn:string ()
222 · pointer_arg:string (N:long)
223 · pp:string ()
224 · print_backtrace ()
225 · probefunc:string ()
226 · register:long(name:string)
227 · str_replace:string(prnt_str:string,srch_str:string,rplc_str:string)
228 · stringat:long(str:string,pos:long)
229 · strlen:long(str:string)
230 · strtol:long(str:string,base:long)
231 · substr:string(str:string,start:long,length:long)
232 · user_long:long(addr:long)
233 · user_string:string(addr:long)
234
235
236
238 stap(1)
239
240
242 Use the Bugzilla link of the project web page or our mailing list.
243 http://sourceware.org/systemtap/,<systemtap@sourceware.org>.
244
245
246
247 STAPREF(1)