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 ARG2=%si 13 OFFS=8 14;; 15i[3456]86) 16 ARG2=%cx 17 OFFS=4 18;; 19aarch64) 20 ARG2=%x1 21 OFFS=8 22;; 23arm*) 24 ARG2=%r1 25 OFFS=4 26;; 27*) 28 echo "Please implement other architecture here" 29 exit_untested 30esac 31 32: "Test get argument (1)" 33echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string" > kprobe_events 34echo 1 > events/kprobes/testprobe/enable 35! echo test >> kprobe_events 36tail -n 1 trace | grep -qe "testprobe.* arg1=\"test\"" 37 38echo 0 > events/kprobes/testprobe/enable 39: "Test get argument (2)" 40echo "p:testprobe create_trace_kprobe arg1=+0(+0(${ARG2})):string arg2=+0(+${OFFS}(${ARG2})):string" > kprobe_events 41echo 1 > events/kprobes/testprobe/enable 42! echo test1 test2 >> kprobe_events 43tail -n 1 trace | grep -qe "testprobe.* arg1=\"test1\" arg2=\"test2\"" 44 45echo 0 > events/enable 46echo > kprobe_events 47