46 lines · plain
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03# description: Kprobe dynamic event with function tracer4# requires: kprobe_events stack_trace_filter function:tracer5 6# prepare7echo nop > current_tracer8echo $FUNCTION_FORK > set_ftrace_filter9echo "p:testprobe $FUNCTION_FORK" > kprobe_events10 11# kprobe on / ftrace off12echo 1 > events/kprobes/testprobe/enable13echo > trace14( echo "forked")15grep testprobe trace16! grep "$FUNCTION_FORK <-" trace17 18# kprobe on / ftrace on19echo function > current_tracer20echo > trace21( echo "forked")22grep testprobe trace23grep "$FUNCTION_FORK <-" trace24 25# kprobe off / ftrace on26echo 0 > events/kprobes/testprobe/enable27echo > trace28( echo "forked")29! grep testprobe trace30grep "$FUNCTION_FORK <-" trace31 32# kprobe on / ftrace on33echo 1 > events/kprobes/testprobe/enable34echo function > current_tracer35echo > trace36( echo "forked")37grep testprobe trace38grep "$FUNCTION_FORK <-" trace39 40# kprobe on / ftrace off41echo nop > current_tracer42echo > trace43( echo "forked")44grep testprobe trace45! grep "$FUNCTION_FORK <-" trace46