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