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