public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH perf/core ] [BUGFIX] perf-probe: Fix to get ummapped symbol address on kernel
@ 2015-03-22 11:40 Masami Hiramatsu
  2015-03-24 16:31 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
  0 siblings, 1 reply; 2+ messages in thread
From: Masami Hiramatsu @ 2015-03-22 11:40 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: wangnan0, Peter Zijlstra, Linux Kernel Mailing List, He Kuang,
	namhyung, Ingo Molnar

Fix to get correctly unmapped symbol address on kernel.
This allows us to probe on syscall symbols which are aliases
of SyS_ functions with using debuginfo.

Without this fix:
  ----
  # ./perf probe -a sys_write
  Failed to find debug information for address 3b0100
  Probe point 'sys_write' not found.
    Error: Failed to add events.
  ----
The address 0x3b0100 is a mapped address, and not usable
in debuginfo.

With this fix:
  ----
  # ./perf probe -a sys_write
  Added new event:
    probe:sys_write      (on sys_write)

  You can now use it in all perf tools, such as:

          perf record -e probe:sys_write -aR sleep 1
  ----

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

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 6b95985..8feac07 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -310,7 +310,10 @@ static int find_alternative_probe_point(struct debuginfo *dinfo,
 
 	/* Find the address of given function */
 	map__for_each_symbol_by_name(map, pp->function, sym) {
-		address = sym->start;
+		if (uprobes)
+			address = sym->start;
+		else
+			address = map->unmap_ip(map, sym->start);
 		break;
 	}
 	if (!address) {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-24 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 11:40 [PATCH perf/core ] [BUGFIX] perf-probe: Fix to get ummapped symbol address on kernel Masami Hiramatsu
2015-03-24 16:31 ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox