From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934833AbcI2SUQ (ORCPT ); Thu, 29 Sep 2016 14:20:16 -0400 Received: from terminus.zytor.com ([198.137.202.10]:52210 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934576AbcI2SUF (ORCPT ); Thu, 29 Sep 2016 14:20:05 -0400 Date: Thu, 29 Sep 2016 11:19:34 -0700 From: tip-bot for Masami Hiramatsu Message-ID: 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 Reply-To: tglx@linutronix.de, peterz@infradead.org, hpa@zytor.com, mingo@kernel.org, namhyung@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, jolsa@kernel.org, dsahern@gmail.com, mhiramat@kernel.org In-Reply-To: <147464489775.29804.3190419491209875936.stgit@devbox> References: <147464489775.29804.3190419491209875936.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Ignore the error of finding inline instance Git-Commit-ID: f8da4b5155ed9a639ee4250746b5f7ffa6302bf6 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 Commit-ID: f8da4b5155ed9a639ee4250746b5f7ffa6302bf6 Gitweb: http://git.kernel.org/tip/f8da4b5155ed9a639ee4250746b5f7ffa6302bf6 Author: Masami Hiramatsu AuthorDate: Sat, 24 Sep 2016 00:34:57 +0900 Committer: Arnaldo Carvalho de Melo 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 Tested-by: Arnaldo Carvalho de Melo Tested-by: Jiri Olsa Cc: David Ahern Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/147464489775.29804.3190419491209875936.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo --- 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; }