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# prepare
7echo nop > current_tracer
8echo _do_fork > set_ftrace_filter
9echo 'p:testprobe _do_fork' > kprobe_events
10
11# kprobe on / ftrace off
12echo 1 > events/kprobes/testprobe/enable
13echo > trace
14( echo "forked")
15grep testprobe trace
16! grep '_do_fork <-' trace
17
18# kprobe on / ftrace on
19echo function > current_tracer
20echo > trace
21( echo "forked")
22grep testprobe trace
23grep '_do_fork <-' trace
24
25# kprobe off / ftrace on
26echo 0 > events/kprobes/testprobe/enable
27echo > trace
28( echo "forked")
29! grep testprobe trace
30grep '_do_fork <-' trace
31
32# kprobe on / ftrace on
33echo 1 > events/kprobes/testprobe/enable
34echo function > current_tracer
35echo > trace
36( echo "forked")
37grep testprobe trace
38grep '_do_fork <-' trace
39
40# kprobe on / ftrace off
41echo nop > current_tracer
42echo > trace
43( echo "forked")
44grep testprobe trace
45! grep '_do_fork <-' trace
46