1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Create/delete multiprobe on kprobe event 4 5[ -f kprobe_events ] || exit_unsupported 6 7grep -q "Create/append/" README || exit_unsupported 8 9# Choose 2 symbols for target 10SYM1=_do_fork 11SYM2=do_exit 12EVENT_NAME=kprobes/testevent 13 14DEF1="p:$EVENT_NAME $SYM1" 15DEF2="p:$EVENT_NAME $SYM2" 16 17:;: "Define an event which has 2 probes" ;: 18echo $DEF1 >> kprobe_events 19echo $DEF2 >> kprobe_events 20cat kprobe_events | grep "$DEF1" 21cat kprobe_events | grep "$DEF2" 22 23:;: "Remove the event by name (should remove both)" ;: 24echo "-:$EVENT_NAME" >> kprobe_events 25test `cat kprobe_events | wc -l` -eq 0 26 27:;: "Remove just 1 event" ;: 28echo $DEF1 >> kprobe_events 29echo $DEF2 >> kprobe_events 30echo "-:$EVENT_NAME $SYM1" >> kprobe_events 31! cat kprobe_events | grep "$DEF1" 32cat kprobe_events | grep "$DEF2" 33 34:;: "Appending different type must fail" ;: 35! echo "$DEF1 \$stack" >> kprobe_events 36