[PATCH -tip v2 5/8] perf-probe: Retry to find given address fromoffline dwarf

From: Masami Hiramatsu
Date: Wed Jan 29 2014 - 04:17:00 EST


Retry to find the given address from offline dwarfs too.

On the KASLR enabled kernel, the kernel text section is
loaded with random offset, and debuginfo__new_online_kernel
tries to map the debuginfo with that offset. However,
perf's map object tries to make a non-randomized ummapped
address. This leads to fail looking up the appropriate
debuginfo from that address.

To solve this issue, we retry to use offline dwarfs if
possible.

Without this change;

# ./perf probe -l
probe:t_show (on _stext+901288 with m v)
probe:t_show_1 (on _stext+939624 with m v t)
probe:t_show_2 (on _stext+980296 with m v fmt)
probe:t_show_3 (on _stext+1014392 with m v file)

With this change;

# ./perf probe -l
probe:t_show (on t_show@linux-3/kernel/trace/ftrace.c with m v)
probe:t_show_1 (on t_show@linux-3/kernel/trace/trace.c with m v t)
probe:t_show_2 (on t_show@kernel/trace/trace_printk.c with m v fmt)
probe:t_show_3 (on t_show@kernel/trace/trace_events.c with m v file)

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@xxxxxxxxxxx>
---
tools/perf/util/probe-event.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 120954b..b35f047 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -272,6 +272,8 @@ static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp,
tp->offset, addr);

dinfo = debuginfo__new_online_kernel(addr);
+ if (!dinfo) /* For kaslr kernel */
+ dinfo = open_debuginfo(tp->module);
if (dinfo) {
ret = debuginfo__find_probe_point(dinfo,
(unsigned long)addr, pp);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/