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 7echo 0 > events/enable 8echo > kprobe_events 9 10case `uname -m` in 11x86_64) 12 ARG1=%di 13;; 14i[3456]86) 15 ARG1=%ax 16;; 17aarch64) 18 ARG1=%x0 19;; 20arm*) 21 ARG1=%r0 22;; 23ppc64*) 24 ARG1=%r3 25;; 26ppc*) 27 ARG1=%r3 28;; 29*) 30 echo "Please implement other architecture here" 31 exit_untested 32esac 33 34: "Test get argument (1)" 35echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string" > kprobe_events 36echo 1 > events/kprobes/testprobe/enable 37echo "p:test _do_fork" >> kprobe_events 38grep -qe "testprobe.* arg1=\"test\"" trace 39 40echo 0 > events/kprobes/testprobe/enable 41: "Test get argument (2)" 42echo "p:testprobe tracefs_create_dir arg1=+0(${ARG1}):string arg2=+0(${ARG1}):string" > kprobe_events 43echo 1 > events/kprobes/testprobe/enable 44echo "p:test _do_fork" >> kprobe_events 45grep -qe "testprobe.* arg1=\"test\" arg2=\"test\"" trace 46 47echo 0 > events/enable 48echo > kprobe_events 49