Staging
v0.8.1
https://github.com/torvalds/linux
Raw File
Tip revision: 651022382c7f8da46cb4872a545ee1da6d097d2a authored by Linus Torvalds on 04 November 2018, 23:37:52 UTC
Linux 4.20-rc1
Tip revision: 6510223
kprobe_ftrace.tc
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# 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 '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
back to top