-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathstap_base.stp
45 lines (38 loc) · 1020 Bytes
/
stap_base.stp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
# Copyright 2015 vonnyfly([email protected])
# suppress some run-time errors here for cleaner output
//bin/true && exec stap --all-modules --suppress-handler-errors --skip-badvars $0 ${1+"$@"}
/* configuration options; set these with stap -G */
global g_extra = 1
global black_lists
global g_incalls
function trace(entry_p, extra) {
if (g_extra == 0) extra = ""
if (tid() in g_incalls)
printf("%s%s%s %s\n",
thread_indent (entry_p),
(entry_p>0?"->":"<-"),
ppfunc (),
extra)
}
probe $2.call {
if (execname() in black_lists) next
trace(1, $$parms)
}
probe $2.return {
if (execname() in black_lists) next
trace(-1, $$return)
}
probe $1.call {
black_lists["stapio"] = 1
black_lists["swapper/0"] = 1
g_incalls[tid()] = 1
trace(1, $$parms)
}
probe $1.return {
trace(-1, $$return)
delete g_incalls[tid()]
printf("\nkernel backtrace:\n")
print_backtrace()
printf("---------------------------------------------------------\n")
}