1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Kretprobe dynamic event with arguments
4
5[ -f kprobe_events ] || exit_unsupported # this is configurable
6
7# Add new kretprobe event
8echo 'r:testprobe2 _do_fork $retval' > kprobe_events
9grep testprobe2 kprobe_events | grep -q 'arg1=\$retval'
10test -d events/kprobes/testprobe2
11
12echo 1 > events/kprobes/testprobe2/enable
13( echo "forked")
14
15cat trace | grep testprobe2 | grep -q '<- _do_fork'
16
17echo 0 > events/kprobes/testprobe2/enable
18echo '-:testprobe2' >> kprobe_events
19clear_trace
20test -d events/kprobes/testprobe2 && exit_fail || exit_pass
21