public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: namhyung@kernel.org, acme@redhat.com, hekuang@huawei.com,
	masami.hiramatsu.pt@hitachi.com, wangnan0@huawei.com,
	tglx@linutronix.de, mingo@kernel.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com,
	peterz@infradead.org
Subject: [tip:perf/core] perf probe: Fix to get ummapped symbol address on kernel
Date: Tue, 24 Mar 2015 09:31:14 -0700	[thread overview]
Message-ID: <tip-e6d7c91c8c5ea532584056f3e8bf1643310c8ef7@git.kernel.org> (raw)
In-Reply-To: <20150322114022.32639.19096.stgit@localhost.localdomain>

Commit-ID:  e6d7c91c8c5ea532584056f3e8bf1643310c8ef7
Gitweb:     http://git.kernel.org/tip/e6d7c91c8c5ea532584056f3e8bf1643310c8ef7
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Sun, 22 Mar 2015 20:40:22 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 24 Mar 2015 12:07:04 -0300

perf probe: Fix to get ummapped symbol address on kernel

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>
Cc: He Kuang <hekuang@huawei.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/20150322114022.32639.19096.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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) {

      reply	other threads:[~2015-03-24 16:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-bot for Masami Hiramatsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-e6d7c91c8c5ea532584056f3e8bf1643310c8ef7@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=hekuang@huawei.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox