2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobe event auto/manual naming
5 [ -f kprobe_events
] || exit_unsupported
# this is configurable
7 :;: "Add an event on function without name" ;:
9 FUNC
=`grep " [tT] .*vfs_read$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
10 [ "x" != "x$FUNC" ] || exit_unresolved
11 echo "p $FUNC" > kprobe_events
12 PROBE_NAME
=`echo $FUNC | tr ".:" "_"`
13 test -d events
/kprobes
/p_
${PROBE_NAME}_0 || exit_failure
15 :;: "Add an event on function with new name" ;:
17 echo "p:event1 $FUNC" > kprobe_events
18 test -d events
/kprobes
/event1 || exit_failure
20 :;: "Add an event on function with new name and group" ;:
22 echo "p:kprobes2/event2 $FUNC" > kprobe_events
23 test -d events
/kprobes
2/event2 || exit_failure
25 :;: "Add an event on dot function without name" ;:
27 FUNC
=`grep -m 10 " [tT] .*\.isra\..*$" /proc/kallsyms | tail -n 1 | cut -f 3 -d " "`
28 [ "x" != "x$FUNC" ] || exit_unresolved
29 echo "p $FUNC" > kprobe_events
30 EVENT
=`grep $FUNC kprobe_events | cut -f 1 -d " " | cut -f 2 -d:`
31 [ "x" != "x$EVENT" ] || exit_failure
32 test -d events
/$EVENT || exit_failure