History

selftests: ftrace: Add a testcase for string type with kprobe_event

Add a testcase for string type with kprobe event. This tests good/bad syntax combinations and also the traced data is correct in several way. Link: http://lkml.kernel.org/r/152129038381.31874.9201387794548737554.stgit@devbox

Masami Hiramatsu committed 8 years ago

Commit 5fbdbed1 parent 871bef21 file · +46 −0Browse files

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t