From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758473AbbKHHcQ (ORCPT ); Sun, 8 Nov 2015 02:32:16 -0500 Received: from terminus.zytor.com ([198.137.202.10]:46066 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754720AbbKHHcL (ORCPT ); Sun, 8 Nov 2015 02:32:11 -0500 Date: Sat, 7 Nov 2015 23:31:59 -0800 From: tip-bot for Andi Kleen Message-ID: Cc: jolsa@kernel.org, tglx@linutronix.de, mingo@kernel.org, acme@redhat.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, ak@linux.intel.com, hpa@zytor.com Reply-To: mingo@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, jolsa@kernel.org, tglx@linutronix.de, ak@linux.intel.com, hpa@zytor.com, namhyung@kernel.org In-Reply-To: <1446779167-18949-1-git-send-email-andi@firstfloor.org> References: <1446779167-18949-1-git-send-email-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] perf annotate: Inform the user about objdump failures in --stdio Git-Commit-ID: 62ec9b3f02a9bccaf699bd4691db98f779c3075f 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: 62ec9b3f02a9bccaf699bd4691db98f779c3075f Gitweb: http://git.kernel.org/tip/62ec9b3f02a9bccaf699bd4691db98f779c3075f Author: Andi Kleen AuthorDate: Thu, 5 Nov 2015 19:06:07 -0800 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 6 Nov 2015 10:20:48 -0300 perf annotate: Inform the user about objdump failures in --stdio When the browser fails to annotate it is difficult for users to find out what went wrong. Add some errors for objdump failures that are displayed in the UI. Note it would be even better to handle these errors smarter, like falling back to the binary when the debug info is somehow corrupted. But for now just giving a better error is an improvement. Committer note: This works for --stdio, where errors just scroll by the screen: # perf annotate --stdio intel_idle Failure running objdump --start-address=0xffffffff81418290 --stop-address=0xffffffff814183ae -l -d --no-show-raw -S -C /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1 2>/dev/null|grep -v /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1|expand Percent | Source code & Disassembly of vmlinux for cycles:pp ------------------------------------------------------------------ And with that one can use that command line to try to find out more about what happened instead of getting a blank screen, an improvement. We need tho to improve this further to get it to work with other UIs, like --tui and --gtk, where it continues showing a blank screen, no messages, as the pr_err() used is enough just for --stdio. Signed-off-by: Andi Kleen Tested-by: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Namhyung Kim Link: http://lkml.kernel.org/r/1446779167-18949-1-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/annotate.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 0fc8d7a..f2974da 100644 --- a/tools/perf/util/annotate.c +++ b/tools/perf/util/annotate.c @@ -1084,6 +1084,7 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize) struct kcore_extract kce; bool delete_extract = false; int lineno = 0; + int nline; if (filename) symbol__join_symfs(symfs_filename, filename); @@ -1179,6 +1180,9 @@ fallback: ret = decompress_to_file(m.ext, symfs_filename, fd); + if (ret) + pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); + free(m.ext); close(fd); @@ -1204,13 +1208,25 @@ fallback: pr_debug("Executing: %s\n", command); file = popen(command, "r"); - if (!file) + if (!file) { + pr_err("Failure running %s\n", command); + /* + * If we were using debug info should retry with + * original binary. + */ goto out_remove_tmp; + } - while (!feof(file)) + nline = 0; + while (!feof(file)) { if (symbol__parse_objdump_line(sym, map, file, privsize, &lineno) < 0) break; + nline++; + } + + if (nline == 0) + pr_err("No output from %s\n", command); /* * kallsyms does not have symbol sizes so there may a nop at the end.