Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683366 > unrolled thread

[PATCH v3 3/4] selftests/ftrace: Add a test to probe module functions

Started by"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
First post2017-07-07 21:00 +0200
Last post2017-07-07 21:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 3/4] selftests/ftrace: Add a test to probe module functions "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2017-07-07 21:00 +0200

#1683366 — [PATCH v3 3/4] selftests/ftrace: Add a test to probe module functions

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2017-07-07 21:00 +0200
Subject[PATCH v3 3/4] selftests/ftrace: Add a test to probe module functions
Message-ID<u0GDU-7Z0-5@gated-at.bofh.it>
Add a kprobes test to ensure that we are able to add a probe on a
module function using 'p <mod>:<func>' format, with/without having to
specify a probe name.

Suggested-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 .../ftrace/test.d/kprobe/kprobe_module.tc          | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
new file mode 100644
index 000000000000..6d634e4b7680
--- /dev/null
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_module.tc
@@ -0,0 +1,28 @@
+#!/bin/sh
+# description: Kprobe dynamic event - probing module
+
+[ -f kprobe_events ] || exit_unsupported # this is configurable
+
+disable_events
+echo > kprobe_events
+
+:;: "Add an event on a module function without specifying event name" ;:
+
+MOD=`lsmod | head -n 2 | tail -n 1 | cut -f1 -d" "`
+FUNC=`grep -m 1 ".* t .*\\[$MOD\\]" /proc/kallsyms | xargs | cut -f3 -d" "`
+[ "x" != "x$MOD" -a "y" != "y$FUNC" ] || exit_unresolved
+echo "p $MOD:$FUNC" > kprobe_events
+PROBE_NAME=`echo $MOD:$FUNC | tr ".:" "_"`
+test -d events/kprobes/p_${PROBE_NAME}_0 || exit_failure
+
+:;: "Add an event on a module function with new event name" ;:
+
+echo "p:event1 $MOD:$FUNC" > kprobe_events
+test -d events/kprobes/event1 || exit_failure
+
+:;: "Add an event on a module function with new event and group name" ;:
+
+echo "p:kprobes1/event1 $MOD:$FUNC" > kprobe_events
+test -d events/kprobes1/event1 || exit_failure
+
+echo > kprobe_events
-- 
2.13.2

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web