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