kprobe_ftrace.tc 1003 字节
Newer Older
1
#!/bin/sh
2
# SPDX-License-Identifier: GPL-2.0
3
# description: Kprobe dynamic event with function tracer
4
# requires: kprobe_events stack_trace_filter function:tracer
5 6 7

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

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

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

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

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

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