From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbbCVLl1 (ORCPT ); Sun, 22 Mar 2015 07:41:27 -0400 Received: from mail7.hitachi.co.jp ([133.145.228.42]:37965 "EHLO mail7.hitachi.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbbCVLlZ (ORCPT ); Sun, 22 Mar 2015 07:41:25 -0400 X-AuditID: 85900ec0-a32cbb9000003d4c-4a-550eaa5fd040 Subject: [PATCH perf/core ] [BUGFIX] perf-probe: Fix to get ummapped symbol address on kernel From: Masami Hiramatsu To: Arnaldo Carvalho de Melo Cc: wangnan0@huawei.com, Peter Zijlstra , Linux Kernel Mailing List , He Kuang , namhyung@kernel.org, Ingo Molnar Date: Sun, 22 Mar 2015 20:40:22 +0900 Message-ID: <20150322114022.32639.19096.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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) {