All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dsahern@gmail.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	naota@elisp.net, mingo@kernel.org, acme@redhat.com,
	masami.hiramatsu.pt@hitachi.com, tglx@linutronix.de,
	jolsa@redhat.com, namhyung@kernel.org, peterz@infradead.org
Subject: [tip:perf/core] perf probe: Cut off the gcc optimization postfixes from function name
Date: Thu, 18 Jun 2015 01:12:38 -0700	[thread overview]
Message-ID: <tip-35a23ff928b066b00a826d0a9ed9411b8ab479ef@git.kernel.org> (raw)
In-Reply-To: <20150612050820.20548.41625.stgit@localhost.localdomain>

Commit-ID:  35a23ff928b066b00a826d0a9ed9411b8ab479ef
Gitweb:     http://git.kernel.org/tip/35a23ff928b066b00a826d0a9ed9411b8ab479ef
Author:     Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
AuthorDate: Fri, 12 Jun 2015 14:08:20 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 12 Jun 2015 16:14:48 -0300

perf probe: Cut off the gcc optimization postfixes from function name

Cut off the postfixes which gcc added for optimized routines from the
event name automatically generated from symbol name, since *probe-events
doesn't accept it.  Those symbols will be used if we don't use debuginfo
to find target functions.

E.g. without this fix;
  -----
  # perf probe -va alloc_buf.isra.23
  probe-definition(0): alloc_buf.isra.23
  symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
  [...]
  Opening /sys/kernel/debug/tracing/kprobe_events write=1
  Added new event:
  Writing event: p:probe/alloc_buf.isra.23 _text+4869328
  Failed to write event: Invalid argument
    Error: Failed to add events. Reason: Invalid argument (Code: -22)
  -----
With this fix;
  -----
  perf probe -va alloc_buf.isra.23
  probe-definition(0): alloc_buf.isra.23
  symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
  [...]
  Opening /sys/kernel/debug/tracing/kprobe_events write=1
  Added new event:
  Writing event: p:probe/alloc_buf _text+4869328
    probe:alloc_buf      (on alloc_buf.isra.23)

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

  	perf record -e probe:alloc_buf -aR sleep 1

  -----

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

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index d4cf50b..daa24a2 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2316,6 +2316,7 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 			      struct strlist *namelist, bool allow_suffix)
 {
 	int i, ret;
+	char *p;
 
 	if (*base == '.')
 		base++;
@@ -2326,6 +2327,10 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 		pr_debug("snprintf() failed: %d\n", ret);
 		return ret;
 	}
+	/* Cut off the postfixes (e.g. .const, .isra)*/
+	p = strchr(buf, '.');
+	if (p && p != buf)
+		*p = '\0';
 	if (!strlist__has_entry(namelist, buf))
 		return 0;
 

  parent reply	other threads:[~2015-06-18  8:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12  5:08 [PATCH perf/core 0/4] perf-probe bugfixes Masami Hiramatsu
2015-06-12  5:08 ` [PATCH perf/core 1/4] [BUGFIX] perf probe: List probes in stdout Masami Hiramatsu
2015-06-12 19:12   ` Arnaldo Carvalho de Melo
2015-06-13  1:14     ` Masami Hiramatsu
2015-06-12  5:08 ` [PATCH perf/core 2/4] [BUGFIX] perf probe: Cut off the postfixes from event name Masami Hiramatsu
2015-06-12 19:16   ` Arnaldo Carvalho de Melo
2015-06-18  8:12   ` tip-bot for Masami Hiramatsu [this message]
2015-06-12  5:08 ` [PATCH perf/core 3/4] [BUGFIX] perf probe: Check non-probe-able symbols when using symbol map Masami Hiramatsu
2015-06-12 19:17   ` Arnaldo Carvalho de Melo
2015-06-13  1:16     ` Masami Hiramatsu
2015-06-12  5:08 ` [PATCH perf/core 4/4] [BUGFIX] perf probe: Show usage even if the last event is skipped Masami Hiramatsu
2015-06-12 19:29 ` [PATCH perf/core 0/4] perf-probe bugfixes 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-35a23ff928b066b00a826d0a9ed9411b8ab479ef@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.