2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobe dynamic event - probing module
5 [ -f kprobe_events ] || exit_unsupported # this is configurable
7 :;: "Add an event on a module function without specifying event name" ;:
9 MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
10 FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
11 [ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_unresolved
12 echo "p $MOD:$FUNC" > kprobe_events
13 PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
14 test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
16 :;: "Add an event on a module function with new event name" ;:
18 echo "p:event1 $MOD:$FUNC" > kprobe_events
19 test -d events/kprobes/event1 || exit_failure
21 :;: "Add an event on a module function with new event and group name" ;:
23 echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
24 test -d events/kprobes1/event1 || exit_failure