summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_ftrace.tc
blob: ab41d2b29841ceb149d59a51649467ec4136e3e1 (plain)
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
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# description: Kprobe dynamic event with function tracer

[ -f kprobe_events ] || exit_unsupported # this is configurable
grep function available_tracers || exit_unsupported # this is configurable

# prepare
echo nop > current_tracer
echo do_fork > set_ftrace_filter
echo 0 > events/enable
echo > kprobe_events
echo 'p:testprobe do_fork' > kprobe_events

# kprobe on / ftrace off
echo 1 > events/kprobes/testprobe/enable
echo > trace
( echo "forked")
grep testprobe trace
! grep 'do_fork <-' trace

# kprobe on / ftrace on
echo function > current_tracer
echo > trace
( echo "forked")
grep testprobe trace
grep 'do_fork <-' trace

# kprobe off / ftrace on
echo 0 > events/kprobes/testprobe/enable
echo > trace
( echo "forked")
! grep testprobe trace
grep 'do_fork <-' trace

# kprobe on / ftrace on
echo 1 > events/kprobes/testprobe/enable
echo function > current_tracer
echo > trace
( echo "forked")
grep testprobe trace
grep 'do_fork <-' trace

# kprobe on / ftrace off
echo nop > current_tracer
echo > trace
( echo "forked")
grep testprobe trace
! grep 'do_fork <-' trace

# cleanup
echo nop > current_tracer
echo > set_ftrace_filter
echo 0 > events/kprobes/testprobe/enable
echo > kprobe_events
echo > trace