[PATCH -tip 2/5] perf probe: Fix return probe support

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Masami Hiramatsu
Date: Friday, August 27, 2010 - 4:38 am

Fix a bug to support %return probe syntax again. Previous commit
4235b04 has a bug which disables the %return syntax on perf probe.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: linux-kernel@vger.kernel.org
---

 tools/perf/util/probe-event.c  |    1 +
 tools/perf/util/probe-finder.c |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index e72f05c..fcc16e4 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -1539,6 +1539,7 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
 		goto error;
 	}
 	tev->point.offset = pev->point.offset;
+	tev->point.retprobe = pev->point.retprobe;
 	tev->nargs = pev->nargs;
 	if (tev->nargs) {
 		tev->args = zalloc(sizeof(struct probe_trace_arg)
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 5251366..9b0e1b1 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -783,6 +783,16 @@ static int convert_probe_point(Dwarf_Die *sp_die, struct probe_finder *pf)
 		/* This function has no name. */
 		tev->point.offset = (unsigned long)pf->addr;
 
+	/* Return probe must be on the head of a subprogram */
+	if (pf->pev->point.retprobe) {
+		if (tev->point.offset != 0) {
+			pr_warning("Return probe must be on the head of"
+				   " a real function\n");
+			return -EINVAL;
+		}
+		tev->point.retprobe = true;
+	}
+
 	pr_debug("Probe point found: %s+%lu\n", tev->point.symbol,
 		 tev->point.offset);
 

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -tip 0/5] Perf and tracing/kprobe fixes, Masami Hiramatsu, (Fri Aug 27, 4:38 am)
[PATCH -tip 1/5] tracing/kprobe: Fix a memory leak in err ..., Masami Hiramatsu, (Fri Aug 27, 4:38 am)
[PATCH -tip 2/5] perf probe: Fix return probe support, Masami Hiramatsu, (Fri Aug 27, 4:38 am)
[PATCH -tip 5/5] tracing/kprobe: Check invalid argument name, Masami Hiramatsu, (Fri Aug 27, 4:39 am)
[tip:perf/core] tracing/kprobe: Fix a memory leak in error ..., tip-bot for Masami H ..., (Thu Sep 9, 12:43 pm)
[tip:perf/core] perf probe: Fix return probe support, tip-bot for Masami H ..., (Thu Sep 9, 12:43 pm)
[tip:perf/core] perf probe: Fix handling of arguments names, tip-bot for Masami H ..., (Thu Sep 9, 12:43 pm)
[tip:perf/core] tracing/kprobes: Fix handling of argument ..., tip-bot for Masami H ..., (Thu Sep 9, 12:44 pm)
[tip:perf/core] tracing/kprobe: Fix handling of C-unlike a ..., tip-bot for Masami H ..., (Thu Sep 9, 12:44 pm)