kprobe_ftrace.tc 1.1 KB
Newer Older
1
#!/bin/sh
2
# SPDX-License-Identifier: GPL-2.0
3 4 5
# description: Kprobe dynamic event with function tracer

[ -f kprobe_events ] || exit_unsupported # this is configurable
6
grep "function" available_tracers || exit_unsupported # this is configurable
7 8 9

# prepare
echo nop > current_tracer
10 11
echo _do_fork > set_ftrace_filter
echo 'p:testprobe _do_fork' > kprobe_events
12 13 14 15 16 17

# kprobe on / ftrace off
echo 1 > events/kprobes/testprobe/enable
echo > trace
( echo "forked")
grep testprobe trace
18
! grep '_do_fork <-' trace
19 20 21 22 23 24

# kprobe on / ftrace on
echo function > current_tracer
echo > trace
( echo "forked")
grep testprobe trace
25
grep '_do_fork <-' trace
26 27 28 29 30 31

# kprobe off / ftrace on
echo 0 > events/kprobes/testprobe/enable
echo > trace
( echo "forked")
! grep testprobe trace
32
grep '_do_fork <-' trace
33 34 35 36 37 38 39

# kprobe on / ftrace on
echo 1 > events/kprobes/testprobe/enable
echo function > current_tracer
echo > trace
( echo "forked")
grep testprobe trace
40
grep '_do_fork <-' trace
41 42 43 44 45 46

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