Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757427AbbEFDMM (ORCPT ); Tue, 5 May 2015 23:12:12 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36229 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757375AbbEFDMG (ORCPT ); Tue, 5 May 2015 23:12:06 -0400 Date: Tue, 5 May 2015 20:10:44 -0700 From: "tip-bot for Naveen N. Rao" Message-ID: Cc: ananth@in.ibm.com, mpe@ellerman.id.au, sukadev@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, mingo@kernel.org, masami.hiramatsu.pt@hitachi.com, srikar@linux.vnet.ibm.com, acme@redhat.com, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: ananth@in.ibm.com, mpe@ellerman.id.au, sukadev@linux.vnet.ibm.com, naveen.n.rao@linux.vnet.ibm.com, mingo@kernel.org, srikar@linux.vnet.ibm.com, masami.hiramatsu.pt@hitachi.com, acme@redhat.com, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <652a8f3bfa919bd02a1836a128370eaed59b4a34.1430217967.git.naveen.n.rao@linux.vnet.ibm.com> References: <652a8f3bfa919bd02a1836a128370eaed59b4a34.1430217967.git.naveen.n.rao@linux.vnet.ibm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe ppc: Enable matching against dot symbols automatically Git-Commit-ID: 031b84c407c3153ffbcb4f8f832edf48af988719 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4628 Lines: 126 Commit-ID: 031b84c407c3153ffbcb4f8f832edf48af988719 Gitweb: http://git.kernel.org/tip/031b84c407c3153ffbcb4f8f832edf48af988719 Author: Naveen N. Rao AuthorDate: Tue, 28 Apr 2015 17:35:37 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 4 May 2015 12:43:44 -0300 perf probe ppc: Enable matching against dot symbols automatically Allow perf probe to work on ppc ABIv1 without the need to specify the leading dot '.' for functions. 'perf probe do_fork' works with this patch. We do this by changing how symbol name comparison works on ppc ABIv1 - we simply ignore and skip over the initial dot, if one exists, during symbol name comparison. Signed-off-by: Naveen N. Rao Reviewed-by: Srikar Dronamraju Cc: Ananth N Mavinakayanahalli Cc: Masami Hiramatsu Cc: Michael Ellerman Cc: Sukadev Bhattiprolu Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/652a8f3bfa919bd02a1836a128370eaed59b4a34.1430217967.git.naveen.n.rao@linux.vnet.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/arch/powerpc/util/sym-handling.c | 13 +++++++++++++ tools/perf/util/map.c | 5 +++++ tools/perf/util/map.h | 3 ++- tools/perf/util/symbol.c | 4 ++-- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/powerpc/util/sym-handling.c b/tools/perf/arch/powerpc/util/sym-handling.c index 5522a40..2de2cc4 100644 --- a/tools/perf/arch/powerpc/util/sym-handling.c +++ b/tools/perf/arch/powerpc/util/sym-handling.c @@ -8,6 +8,7 @@ #include "debug.h" #include "symbol.h" +#include "map.h" #ifdef HAVE_LIBELF_SUPPORT bool elf__needs_adjust_symbols(GElf_Ehdr ehdr) @@ -36,4 +37,16 @@ int arch__choose_best_symbol(struct symbol *syma, return SYMBOL_A; } + +/* Allow matching against dot variants */ +int arch__compare_symbol_names(const char *namea, const char *nameb) +{ + /* Skip over initial dot */ + if (*namea == '.') + namea++; + if (*nameb == '.') + nameb++; + + return strcmp(namea, nameb); +} #endif diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index a14f08f..cd0e335 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c @@ -292,6 +292,11 @@ int map__load(struct map *map, symbol_filter_t filter) return 0; } +int __weak arch__compare_symbol_names(const char *namea, const char *nameb) +{ + return strcmp(namea, nameb); +} + struct symbol *map__find_symbol(struct map *map, u64 addr, symbol_filter_t filter) { diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index ec19c59..4e0c729 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -124,7 +124,7 @@ struct thread; */ #define __map__for_each_symbol_by_name(map, sym_name, pos, filter) \ for (pos = map__find_symbol_by_name(map, sym_name, filter); \ - pos && strcmp(pos->name, sym_name) == 0; \ + pos && arch__compare_symbol_names(pos->name, sym_name) == 0; \ pos = symbol__next_by_name(pos)) #define map__for_each_symbol_by_name(map, sym_name, pos) \ @@ -132,6 +132,7 @@ struct thread; typedef int (*symbol_filter_t)(struct map *map, struct symbol *sym); +int arch__compare_symbol_names(const char *namea, const char *nameb); void map__init(struct map *map, enum map_type type, u64 start, u64 end, u64 pgoff, struct dso *dso); struct map *map__new(struct machine *machine, u64 start, u64 len, diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f805757..45ba48a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -411,7 +411,7 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, int cmp; s = rb_entry(n, struct symbol_name_rb_node, rb_node); - cmp = strcmp(name, s->sym.name); + cmp = arch__compare_symbol_names(name, s->sym.name); if (cmp < 0) n = n->rb_left; @@ -429,7 +429,7 @@ static struct symbol *symbols__find_by_name(struct rb_root *symbols, struct symbol_name_rb_node *tmp; tmp = rb_entry(n, struct symbol_name_rb_node, rb_node); - if (strcmp(tmp->sym.name, s->sym.name)) + if (arch__compare_symbol_names(tmp->sym.name, s->sym.name)) break; s = tmp; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/