WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / ftrace / test.d / kprobe / multiple_kprobes.tc
blob312d237800969e67432468e06baead6f82287c5e
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 # description: Register/unregister many kprobe events
4 # requires: kprobe_events
6 # ftrace fentry skip size depends on the machine architecture.
7 # Currently HAVE_KPROBES_ON_FTRACE defined on x86 and powerpc64le
8 case `uname -m` in
9 x86_64|i[3456]86) OFFS=5;;
10 ppc64le) OFFS=8;;
11 *) OFFS=0;;
12 esac
14 N=0
15 echo "Setup up kprobes on first available 256 text symbols"
16 grep -i " t " /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
17 while read i; do
18 echo p ${i}+${OFFS} >> kprobe_events && N=$((N+1)) ||:
19 test $N -eq 256 && break
20 done
22 L=`cat kprobe_events | wc -l`
23 if [ $L -ne 256 ]; then
24 echo "The number of kprobes events ($L) is not 256"
25 exit_fail
28 echo 1 > events/kprobes/enable
29 echo 0 > events/kprobes/enable
30 echo > kprobe_events
31 echo "Waiting for unoptimizing & freeing"
32 sleep 5
33 echo "Done"