linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Namhyung Kim <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, namhyung@kernel.org, hpa@zytor.com,
	naota@elisp.net, acme@redhat.com, tglx@linutronix.de,
	mingo@kernel.org, peterz@infradead.org,
	masami.hiramatsu.pt@hitachi.com, dsahern@gmail.com,
	jolsa@redhat.com
Subject: [tip:perf/core] perf probe: Allow weak symbols to be probed
Date: Sat, 14 Mar 2015 00:03:41 -0700	[thread overview]
Message-ID: <tip-e578da3b2009da2a9ae2d25fd0f78c7b76ca5e56@git.kernel.org> (raw)
In-Reply-To: <20150306073129.6904.41078.stgit@localhost.localdomain>

Commit-ID:  e578da3b2009da2a9ae2d25fd0f78c7b76ca5e56
Gitweb:     http://git.kernel.org/tip/e578da3b2009da2a9ae2d25fd0f78c7b76ca5e56
Author:     Namhyung Kim <namhyung@kernel.org>
AuthorDate: Fri, 6 Mar 2015 16:31:29 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 12 Mar 2015 12:39:55 -0300

perf probe: Allow weak symbols to be probed

It currently prevents adding probes in weak symbols.  But there're cases
that given name is an only weak symbol so that we cannot add probe.

  $ perf probe -x /usr/lib/libc.so.6 -a calloc
  Failed to find symbol calloc in /usr/lib/libc-2.21.so
    Error: Failed to add events.

  $ nm /usr/lib/libc.so.6 | grep calloc
  000000000007b1f0 t __calloc
  000000000007b1f0 T __libc_calloc
  000000000007b1f0 W calloc

This change will result in duplicate probes when strong and weak symbols
co-exist in a binary.  But I think it's not a big problem since probes
at the weak symbol will never be hit anyway.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Naohiro Aota <naota@elisp.net>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20150306073129.6904.41078.stgit@localhost.localdomain
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9feba0e..8af8e7f 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -310,10 +310,8 @@ 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) {
-		if (sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) {
-			address = sym->start;
-			break;
-		}
+		address = sym->start;
+		break;
 	}
 	if (!address) {
 		ret = -ENOENT;
@@ -2485,8 +2483,7 @@ static int find_probe_functions(struct map *map, char *name)
 	struct symbol *sym;
 
 	map__for_each_symbol_by_name(map, name, sym) {
-		if (sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL)
-			found++;
+		found++;
 	}
 
 	return found;
@@ -2846,8 +2843,7 @@ static struct strfilter *available_func_filter;
 static int filter_available_functions(struct map *map __maybe_unused,
 				      struct symbol *sym)
 {
-	if ((sym->binding == STB_GLOBAL || sym->binding == STB_LOCAL) &&
-	    strfilter__compare(available_func_filter, sym->name))
+	if (strfilter__compare(available_func_filter, sym->name))
 		return 0;
 	return 1;
 }

  reply	other threads:[~2015-03-14  7:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-06  7:31 [PATCH perf/core v2 0/5] perf-probe: improve glibc support Masami Hiramatsu
2015-03-06  7:31 ` [PATCH perf/core v2 1/5] perf-probe: Fix to handle aliased symbols in glibc Masami Hiramatsu
2015-03-06 17:59   ` Arnaldo Carvalho de Melo
2015-03-06 18:02     ` Arnaldo Carvalho de Melo
2015-03-14  7:02   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2015-03-06  7:31 ` [PATCH perf/core v2 2/5] perf-probe: Fix --line " Masami Hiramatsu
2015-03-14  7:02   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2015-03-06  7:31 ` [PATCH perf/core v2 3/5] Revert "perf probe: Fix to fall back to find probe point in symbols" Masami Hiramatsu
2015-03-14  7:03   ` [tip:perf/core] " tip-bot for Masami Hiramatsu
2015-03-06  7:31 ` [PATCH perf/core v2 4/5] perf symbols: Allow symbol alias when loading map for symbol name Masami Hiramatsu
2015-03-06 18:06   ` Arnaldo Carvalho de Melo
2015-03-06 18:26     ` Arnaldo Carvalho de Melo
2015-03-06 18:32       ` Arnaldo Carvalho de Melo
2015-03-14  7:03   ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-03-06  7:31 ` [PATCH perf/core v2 5/5] perf probe: Allow weak symbols to be probed Masami Hiramatsu
2015-03-14  7:03   ` tip-bot for Namhyung Kim [this message]
2015-03-06 18:45 ` [PATCH perf/core v2 0/5] perf-probe: improve glibc support Arnaldo Carvalho de Melo

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-e578da3b2009da2a9ae2d25fd0f78c7b76ca5e56@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.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=naota@elisp.net \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).