• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3# description: Kprobe event string type argument
4
5[ -f kprobe_events ] || exit_unsupported # this is configurable
6
7case `uname -m` in
8x86_64)
9  ARG1=%di
10;;
11i[3456]86)
12  ARG1=%ax
13;;
14aarch64)
15  ARG1=%x0
16;;
17arm*)
18  ARG1=%r0
19;;
20ppc64*)
21  ARG1=%r3
22;;
23ppc*)
24  ARG1=%r3
25;;
26*)
27  echo "Please implement other architecture here"
28  exit_untested
29esac
30
31: "Test get argument (1)"
32echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events
33echo 1 > events/kprobes/testprobe/enable
34echo "p:test _do_fork" >> kprobe_events
35grep -qe "testprobe.* arg1=\"test\"" trace
36
37echo 0 > events/kprobes/testprobe/enable
38: "Test get argument (2)"
39echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events
40echo 1 > events/kprobes/testprobe/enable
41echo "p:test _do_fork" >> kprobe_events
42grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace
43
44