Debian Codegraph @

testsuite/systemtap.syscall/all_syscalls.stp

raw
1 #!/usr/bin/env stap
2
3 # Show all the systemcalls that an executable makes.
4 # Usage: stap -c progname all_syscalls.stp OR
5 # ./all_syscalls.stp -c progname
6
7 global indent, indent_str
8
9 probe begin {
10 indent = 0
11 for (i=0; i<20; i++) {
12 if (i == 0)
13 indent_str[0] = ""
14 else
15 indent_str[i] = indent_str[i-1] . " "
16 }
17 }
18
19
20 probe kernel.function("sys_*") ?,
21 kernel.function("sys32_*") ?,
22 kernel.function("compat_sys_*") ?
23 {
24 if (pid() == target()) {
25 printf("%s%s\n", indent_str[indent], pp())
26 indent++
27 }
28 }
29
30 probe kernel.function("sys_*").return ?,
31 kernel.function("sys32_*").return ?,
32 kernel.function("compat_sys_*").return ?
33 {
34 if (pid() == target()) {
35 if (indent) indent--
36 }
37 }
38
39 probe end {
40 printf("\n")
41 }