2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobes event arguments with types
4 # requires: kprobe_events "x8/16/32/64":README
6 gen_event() { # Bitsize
7 echo "p:testprobe _do_fork \$stack0:s$1 \$stack0:u$1 \$stack0:x$1 \$stack0:b4@4/$1"
10 check_types() { # s-type u-type x-type bf-type width
14 X1=`printf "%x" $1 | tail -c ${CW}`
22 B3=`printf "%03x" 0x$X3 | tail -c 2 | head -c 1`
26 for width in 64 32 16 8; do
27 : "Add new event with basic types"
28 gen_event $width > kprobe_events
29 grep testprobe kprobe_events
30 test -d events/kprobes/testprobe
33 echo 1 > events/kprobes/testprobe/enable
35 echo 0 > events/kprobes/testprobe/enable
37 : "Confirm the arguments is recorded in given types correctly"
38 ARGS=`grep "testprobe" trace | head -n 1 | sed -e 's/.* arg1=\(.*\) arg2=\(.*\) arg3=\(.*\) arg4=\(.*\)/\1 \2 \3 \4/'`
39 check_types $ARGS $width
41 : "Clear event for next loop"
42 echo "-:testprobe" >> kprobe_events