1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Generic dynamic event - add/remove kprobe events
4# requires: dynamic_events "place: [<module>:]<symbol>":README "place (kretprobe): [<module>:]<symbol>":README
5
6echo 0 > events/enable
7echo > dynamic_events
8
9PLACE=$FUNCTION_FORK
10
11echo "p:myevent1 $PLACE" >> dynamic_events
12echo "r:myevent2 $PLACE" >> dynamic_events
13
14grep -q myevent1 dynamic_events
15grep -q myevent2 dynamic_events
16test -d events/kprobes/myevent1
17test -d events/kprobes/myevent2
18
19echo "-:myevent2" >> dynamic_events
20
21grep -q myevent1 dynamic_events
22! grep -q myevent2 dynamic_events
23
24echo > dynamic_events
25
26if grep -q "p\[:\[<group>/]\[<event>]]" README; then
27	echo "p:mygroup/ $PLACE" >> dynamic_events
28	test -d events/mygroup
29	echo "-:mygroup/" >> dynamic_events
30	! test -d events/mygroup
31fi
32
33clear_trace
34