summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc
blob: a202b2ea4baf98e8556263b27b125d66b056038a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: Kprobe event string type argument
# requires: kprobe_events

case `uname -m` in
x86_64)
  ARG1=%di
;;
i[3456]86)
  ARG1=%ax
;;
aarch64)
  ARG1=%x0
;;
arm*)
  ARG1=%r0
;;
ppc64*)
  ARG1=%r3
;;
ppc*)
  ARG1=%r3
;;
s390*)
  ARG1=%r2
;;
mips*)
  ARG1=%r4
;;
loongarch*)
  ARG1=%r4
;;
*)
  echo "Please implement other architecture here"
  exit_untested
esac

: "Test get argument (1)"
if grep -q eventfs_add_dir available_filter_functions; then
  DIR_NAME="eventfs_add_dir"
else
  DIR_NAME="tracefs_create_dir"
fi
echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string" > kprobe_events
echo 1 > events/kprobes/testprobe/enable
echo "p:test $FUNCTION_FORK" >> kprobe_events
grep -qe "testprobe.* arg1=\"test\"" trace

echo 0 > events/kprobes/testprobe/enable
: "Test get argument (2)"
echo "p:testprobe ${DIR_NAME} arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
echo 1 > events/kprobes/testprobe/enable
echo "p:test $FUNCTION_FORK" >> kprobe_events
grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace