Debian Codegraph @

doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/caller.exp

raw
1 set test "caller"
2
3 if {! [installtest_p]} { untested "$test"; return }
4
5 set test_script {
6 global caller_str
7
8 probe begin {
9 printf("systemtap starting probe\n")
10 }
11
12 probe kernel.function("vfs_write") {
13 caller_str = caller()
14 exit()
15 }
16
17 probe end {
18 printf("systemtap ending probe\n")
19 printf("%s\n", caller_str)
20 }
21 }
22
23 # We expect that the caller of vfs_write() will be sys_write(). This
24 # works on most systems, except for ppc64 (3.10.0-327.el7.ppc64),
25 # where vfs_write() can get inlined. So, we expect system_call() or
26 # vfs_write() on ppc64.
27 if {[string match ppc* $::tcl_platform(machine)]} {
28 set output {([Ss]y[Ss]_write|system_call) 0x[0-9a-f]+\r\n}
29 } else {
30 set output {[Ss]y[Ss]_write 0x[0-9a-f]+\r\n}
31 }
32 stap_run $test no_load $output -e $test_script -c "echo hi > /dev/null"