File Index
Files and directories
Sign in
FILE

multiple_kprobes.tc

File preview with syntax highlighting.

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