Debian Codegraph @

man/stapref.1

raw
1 .\" -*- nroff -*-
2 .TH STAPREF 1
3 .SH NAME
4 stapref \- systemtap language reference
5
6 .\" macros
7 .\" do not nest SAMPLEs
8 .de SAMPLE
9 .br
10 .nr oldin \\n(.i
11 .RS
12 .nf
13 .nh
14 ..
15 .de ESAMPLE
16 .hy
17 .fi
18 .RE
19 .in \\n[oldin]u
20
21 ..
22
23 .SH SYNOPSIS
24
25 .br
26 .B stapref
27
28 .SH DESCRIPTION
29
30 The reference for the systemtap scripting language.
31
32 .SH LANGUAGE
33 Keywords
34 .SAMPLE
35 \[bu] \fBbreak\fR
36 \[bu] \fBcontinue\fR
37 \[bu] \fBdelete\fR
38 \[bu] \fBelse\fR
39 \[bu] \fBexit\fR
40 \[bu] \fBforeach\fR
41 \[bu] \fBfor\fR
42 \[bu] \fBfunction\fR
43 \[bu] \fBglobal\fR
44 \[bu] \fBprivate\fR
45 \[bu] \fBif\fR
46 \[bu] \fBin\fR
47 \[bu] \fBnext\fR
48 \[bu] \fBprobe\fR
49 \[bu] \fBreturn\fR
50 \[bu] \fBtry/catch\fR
51 \[bu] \fBwhile\fR
52 .ESAMPLE
53
54 Data Types and Operators
55 .SAMPLE
56 Integers
57 \[bu] var1 = 5
58 \[bu] \fBglobal\fR var2 = 10
59
60 Strings
61 \[bu] var1 = "string1"
62 \[bu] \fBglobal\fR var2 = "string2"
63
64 Associative Arrays
65 \[bu] \fBglobal\fR array1[]
66 \[bu] \fBglobal\fR array2[SIZE]
67 \[bu] array[index] = 5
68
69 Context Variables
70 \[bu] \fB$\fRvar
71 \[bu] \fB$\fRvar\fB$\fR \fI(pretty printed string form)\fP
72
73 Binary numeric operators
74 \[bu] \fB* / % + \- << >> >>> & ^ | && ||\fR
75
76 Binary string operators
77 \[bu] \fB.\fR \fI(string concatenation)\fP
78
79 Numeric assignment operators
80 \[bu] \fB= += -= *= /= %= >>= <<= &= ^= |= \fR
81
82 String assignment operators
83 \[bu] \fB= .= \fR
84
85 Unary numeric operators
86 \[bu] \fB+ \- ! ~ ++ \-\- \fR
87
88 Numeric & string comparison operators
89 \[bu] \fB< > <= >= == != \fR
90
91 Regular expression matching operators
92 \[bu] \fB=~ !~ \fR
93
94 Ternary operator
95 \[bu] cond \fB?\fR exp1 \fB:\fR exp2
96
97 Grouping operator
98 \[bu] \fB(\fR expression \fB)\fR
99
100 Array operators
101 \[bu] array\fB[\fRindex\fB]\fR \fI(array read/write)\fP
102 \[bu] [index] \fB\in\fR array
103
104 Aggregation operator
105 \[bu] var \fB<<<\fR value
106 .ESAMPLE
107
108 Statements
109 .SAMPLE
110 Jump Statements
111 \[bu] \fBcontinue\fR
112 \[bu] \fBbreak\fR
113 \[bu] \fBnext\fR \fI(early return from a probe)\fP
114 \[bu] \fBreturn\fR expression \fI(from a function)\fP
115 \[bu] \fBtry\fR statement \fBcatch\fR (message) statement
116 .ESAMPLE
117 .SAMPLE
118 Selection Statements
119 \[bu] \fBif\fR (expression) statement
120 \[bu] \fBelse\fR statement
121 .ESAMPLE
122 .SAMPLE
123 Iteration Statements
124 \[bu] \fBforeach\fR (variable \fBin\fR array) statement
125 \[bu] \fBforeach\fR ([var1,var2,...] \fBin\fR array) statement
126 \[bu] \fBfor\fR (expression; expression; expression) statement
127 \[bu] \fBwhile\fR (expression) statement
128 .ESAMPLE
129 .SAMPLE
130 Declaration Statements
131 \[bu] \fBfunction\fR name (variable : type, ...) { statement }
132 \[bu] \fBfunction\fR name : type (variable : type, ...) { statement }
133 \[bu] \fBfunction\fR name : type (variable : type, ...) %{ c_statement %}
134 \[bu] \fBprobe\fR probepoint { statement }
135 \[bu] \fBprobe\fR label = probepoint { statement }
136 .ESAMPLE
137
138 Lexical Structure
139 .SAMPLE
140 Comments
141 \[bu] \fB#\fR ... comment
142 \[bu] \fB//\fR ... comment
143 \[bu] \fB/*\fR ... comment ... \fB*/\fR
144 .ESAMPLE
145 .SAMPLE
146 Preprocessor
147 \[bu] \fB%(\fR expression \fB%?\fR true_tokens \fB%:\fR false_tokens \fB%)\fR
148 \[bu] \fB@define\fR label (variable, ...) %{ statement %}
149 .ESAMPLE
150
151 Builtin Functions
152 .SAMPLE
153 Aggregation Builtin Functions
154 \[bu] \fB@avg\fR (variable)
155 \[bu] \fB@count\fR (variable)
156 \[bu] \fB@hist_linear\fR (variable, N, N, N)
157 \[bu] \fB@hist_log\fR (variable)
158 \[bu] \fB@max\fR (variable)
159 \[bu] \fB@min\fR (variable)
160 \[bu] \fB@sum\fR (variable)
161 .ESAMPLE
162 .SAMPLE
163 Output Builtin Functions
164 \[bu] \fBprint\fR (variable)
165 \[bu] \fBprintf\fR (format:string, variable, ...)
166 \ where format is of the form: %[flags][width][.precision][length]specifier
167 \[bu] \fBprintd\fR (delimiter:string, variable, ...)
168 \[bu] \fBprintdln\fR (delimiter:string, variable, ...)
169 \[bu] \fBprintln\fR ()
170 \[bu] \fBsprint\fR:string (variable)
171 \[bu] \fBsprintf\fR:string (format:string, variable, ...)
172 .ESAMPLE
173 .SAMPLE
174 Variable Access Builtin Functions
175 \[bu] \fB@var\fR ("varname[@src/FILE.c]"[, "module"]) \fI(static or global)\fP
176 \[bu] \fB@cast\fR (variable, "type_name"[, "module"])
177 \[bu] \fB@defined\fR (variable)
178 \[bu] \fB@probewrite\fR (variable)
179 .ESAMPLE
180
181 Probepoints
182 .SAMPLE
183 Some of the more commonly used probepoints
184 \[bu] kernel.function(PATTERN) kernel.function(PATTERN).call
185 \[bu] kernel.function(PATTERN).return
186 \[bu] kernel.FUNCTION (PATTERN).return.maxactive(VALUE)
187 \[bu] kernel.FUNCTION (PATTERN).inline
188 \[bu] kernel.FUNCTION (PATTERN).label(LPATTERN)
189 \[bu] module(MPATTERN).FUNCTION (PATTERN)
190 \[bu] module(MPATTERN).FUNCTION (PATTERN).call
191 \[bu] module(MPATTERN).FUNCTION (PATTERN).return.maxactive(VALUE)
192 \[bu] module(MPATTERN).FUNCTION (PATTERN).inline
193 \[bu] kernel.statement(PATTERN)
194 \[bu] kernel.statement(ADDRESS).absolute
195 \[bu] module(MPATTERN).statement(PATTERN)
196 \[bu] kprobe.FUNCTION (FUNCTION)
197 \[bu] kprobe.FUNCTION (FUNCTION).return
198 \[bu] kprobe.module(NAME).FUNCTION (FUNCTION)
199 \[bu] kprobe.module(NAME).FUNCTION (FUNCTION).return
200 \[bu] kprobe.statement(ADDRESS).absolute
201 \[bu] process.begin process("PATH").begin
202 \[bu] process(PID).begin process.thread.begin
203 \[bu] process("PATH").thread.begin
204 \[bu] process(PID).thread.begin
205 \[bu] process.end
206 \[bu] process("PATH").end
207 \[bu] process(PID).end
208 \[bu] process.thread.end
209 \[bu] process("PATH").thread.end
210 \[bu] process(PID).thread.end
211 \[bu] process("PATH").syscall
212 \[bu] process(PID).syscall
213 \[bu] process.syscall.return
214 \[bu] process("PATH").syscall.return
215 \[bu] process(PID).syscall.return
216 \[bu] process("PATH").FUNCTION ("NAME")
217 \[bu] process("PATH").statement("*@FILE.c:123")
218 \[bu] process("PATH").FUNCTION ("*").return
219 \[bu] process("PATH").FUNCTION ("myfun").label("foo")
220 \[bu] process("PATH").mark("LABEL")
221 \[bu] java("PNAME").class("CLASSNAME").method("PATTERN")
222 \[bu] java("PNAME").class("CLASSNAME").method("PATTERN").return
223 \[bu] java(PID).class("CLASSNAME").method("PATTERN")
224 \[bu] java(PID).class("CLASSNAME").method("PATTERN").return
225 \[bu] python2.module("MODULENAME").function("PATTERN")
226 \[bu] python2.module("MODULENAME").function("PATTERN").return
227 \[bu] python3.module("MODULENAME").function("PATTERN")
228 \[bu] python3.module("MODULENAME").function("PATTERN").return
229 .ESAMPLE
230
231 Tapset Functions
232 .SAMPLE
233 Some of the more commonly used tapset functions
234 \[bu] addr:long ()
235 \[bu] backtrace:string ()
236 \[bu] caller:string ()
237 \[bu] caller_addr:long ()
238 \[bu] cmdline_arg:string (N:long)
239 \[bu] cmdline_args:string (N:long,m:long,delim:string)
240 \[bu] cmdline_str:string ()
241 \[bu] env_var:string (name:string)
242 \[bu] execname:string ()
243 \[bu] int_arg:long (N:long)
244 \[bu] isinstr:long(s1:string,s2:string)
245 \[bu] long_arg:long (N:long)
246 \[bu] modname:string ()
247 \[bu] module_name:string ()
248 \[bu] pid:long ()
249 \[bu] pn:string ()
250 \[bu] pointer_arg:string (N:long)
251 \[bu] pp:string ()
252 \[bu] print_backtrace ()
253 \[bu] probefunc:string ()
254 \[bu] register:long(name:string)
255 \[bu] str_replace:string(prnt_str:string,srch_str:string,rplc_str:string)
256 \[bu] stringat:long(str:string,pos:long)
257 \[bu] strlen:long(str:string)
258 \[bu] strtol:long(str:string,base:long)
259 \[bu] substr:string(str:string,start:long,length:long)
260 \[bu] user_long:long(addr:long)
261 \[bu] user_string:string(addr:long)
262 .ESAMPLE
263
264 .SH SEE ALSO
265 .nh
266 .nf
267 .IR stap (1)
268
269 .SH BUGS
270 Use the Bugzilla link of the project web page or our mailing list.
271 .nh
272 .BR http://sourceware.org/systemtap/ , <[email protected]> .
273 .hy