linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: tip-bot for Masami Hiramatsu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: mhiramat@kernel.org, jolsa@kernel.org, dsahern@gmail.com,
	linux-kernel@vger.kernel.org, namhyung@kernel.org,
	acme@redhat.com, mingo@kernel.org, hpa@zytor.com,
	peterz@infradead.org, tglx@linutronix.de
Subject: [tip:perf/core] perf probe: Ignore the error of finding inline instance
Date: Thu, 29 Sep 2016 11:19:34 -0700	[thread overview]
Message-ID: <tip-f8da4b5155ed9a639ee4250746b5f7ffa6302bf6@git.kernel.org> (raw)
In-Reply-To: <147464489775.29804.3190419491209875936.stgit@devbox>

Commit-ID:  f8da4b5155ed9a639ee4250746b5f7ffa6302bf6
Gitweb:     http://git.kernel.org/tip/f8da4b5155ed9a639ee4250746b5f7ffa6302bf6
Author:     Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Sat, 24 Sep 2016 00:34:57 +0900
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 29 Sep 2016 11:17:07 -0300

perf probe: Ignore the error of finding inline instance

Ignore the error when the perf probe failed to find inline function
instances. This can happen when we search a method in C++ debuginfo.  If
there is completely no instance in target, perf probe can return an
error.

E.g. without this fix:
  ----
  $ perf probe -x /usr/lib64/libstdc++.so.6 -vD showmanyc
  probe-definition(0): showmanyc
  symbol:showmanyc file:(null) line:0 offset:0 return:0 lazy:(null)
  0 arguments
  symbol:catch file:(null) line:0 offset:0 return:0 lazy:(null)
  symbol:throw file:(null) line:0 offset:0 return:0 lazy:(null)
  symbol:rethrow file:(null) line:0 offset:0 return:0 lazy:(null)
  Open Debuginfo file: /usr/lib/debug/usr/lib64/libstdc++.so.6.0.22.debug
  Try to find probe point from debuginfo.
  Matched function: showmanyc
  An error occurred in debuginfo analysis (-2).
  Trying to use symbols.
  Failed to find symbol showmanyc in /usr/lib64/libstdc++.so.6.0.22
    Error: Failed to add events. Reason: No such file or directory (Code: -2)
  ----

This is because one of showmanyc is defined as inline but no instance
found. With this fix, it is succeeded to show as below.
  ----
  $ perf probe -x /usr/lib64/libstdc++.so.6 -D showmanyc
  p:probe_libstdc++/showmanyc /usr/lib64/libstdc++.so.6.0.22:0xb0e50
  p:probe_libstdc++/showmanyc_1 /usr/lib64/libstdc++.so.6.0.22:0xc7c40
  p:probe_libstdc++/showmanyc_2 /usr/lib64/libstdc++.so.6.0.22:0xecfa0
  p:probe_libstdc++/showmanyc_3 /usr/lib64/libstdc++.so.6.0.22:0x115fc0
  p:probe_libstdc++/showmanyc_4 /usr/lib64/libstdc++.so.6.0.22:0x121a90
  ----

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/147464489775.29804.3190419491209875936.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-finder.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 8daca4f..5fe8325 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -988,7 +988,8 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
 	if (pp->file && strtailcmp(pp->file, dwarf_decl_file(sp_die)))
 		return DWARF_CB_OK;
 
-	pr_debug("Matched function: %s\n", dwarf_diename(sp_die));
+	pr_debug("Matched function: %s [%lx]\n", dwarf_diename(sp_die),
+		 (unsigned long)dwarf_dieoffset(sp_die));
 	pf->fname = dwarf_decl_file(sp_die);
 	if (pp->line) { /* Function relative line */
 		dwarf_decl_line(sp_die, &pf->lno);
@@ -1011,7 +1012,7 @@ static int probe_point_search_cb(Dwarf_Die *sp_die, void *data)
 		param->retval = die_walk_instances(sp_die,
 					probe_point_inline_cb, (void *)pf);
 		/* This could be a non-existed inline definition */
-		if (param->retval == -ENOENT && strisglob(pp->function))
+		if (param->retval == -ENOENT)
 			param->retval = 0;
 	}
 

  reply	other threads:[~2016-09-29 18:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23 15:34 [PATCH perf/core 0/4] perf-probe fixes for C++ Masami Hiramatsu
2016-09-23 15:34 ` [PATCH perf/core 1/4] perf-probe: Ignore the error of finding inline instance Masami Hiramatsu
2016-09-29 18:19   ` tip-bot for Masami Hiramatsu [this message]
2016-09-23 15:35 ` [PATCH perf/core 2/4] perf-probe: Skip if the function address is 0 Masami Hiramatsu
2016-09-29 18:19   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2016-09-23 15:35 ` [PATCH perf/core 3/4] perf-probe: Fix to cut off incompatible chars from group name Masami Hiramatsu
2016-09-29 18:20   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2016-09-23 15:35 ` [PATCH perf/core 4/4] perf-probe: Match linkage name with mangled name Masami Hiramatsu
2016-09-29 18:20   ` [tip:perf/core] perf probe: " tip-bot for Masami Hiramatsu
2016-09-25 11:14 ` [PATCH perf/core 0/4] perf-probe fixes for C++ Jiri Olsa
2016-09-27 18:11   ` Masami Hiramatsu

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-f8da4b5155ed9a639ee4250746b5f7ffa6302bf6@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --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).