1#!/bin/sh
2# description: Register/unregister many kprobe events
3
4[ -f kprobe_events ] || exit_unsupported # this is configurable
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
14echo "Setup up to 256 kprobes"
15grep t /proc/kallsyms | cut -f3 -d" " | grep -v .*\\..* | \
16head -n 256 | while read i; do echo p ${i}+${OFFS} ; done > kprobe_events ||:
17
18echo 1 > events/kprobes/enable
19echo 0 > events/kprobes/enable
20echo > kprobe_events
21echo "Waiting for unoptimizing & freeing"
22sleep 5
23echo "Done"
24