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

SEE ALSO

232       stap(1)
233
234

BUGS

236       Use  the  Bugzilla  link  of  the project web page or our mailing list.
237       http://sourceware.org/systemtap/,<systemtap@sourceware.org>.
238
239
240
241                                                                    STAPREF(1)
Impressum