From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161333AbbKFNN3 (ORCPT ); Fri, 6 Nov 2015 08:13:29 -0500 Received: from mail.kernel.org ([198.145.29.136]:34149 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033190AbbKFNN1 (ORCPT ); Fri, 6 Nov 2015 08:13:27 -0500 Date: Fri, 6 Nov 2015 10:13:19 -0300 From: Arnaldo Carvalho de Melo To: Andi Kleen Cc: jolsa@kernel.org, namhyung@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH] perf, tools: Add better errors to annotate Message-ID: <20151106131319.GZ13236@kernel.org> References: <1446779167-18949-1-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1446779167-18949-1-git-send-email-andi@firstfloor.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Nov 05, 2015 at 07:06:07PM -0800, Andi Kleen escreveu: > From: Andi Kleen > > 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 event 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. So this is an improvement for 'perf ann otate --stdio', where, after I added a (1 ||) to one of the paths you added a pr_err(), I got: [root@zoo ~]# perf annotate --stdio intel_idle no symbols found in /usr/bin/procmail, maybe install a debug package? Failed to open /tmp/perf-8683.map, continuing without symbols Failure running objdump --start-address=0xffffffff81418290 --stop-address=0xffffffff814183ae -l -d --no-show-ra Percent | Source code & Disassembly of vmlinux for cycles:pp ------------------------------------------------------------------ But doesn't work at all for --tui (and probably --gtk), where it will print the warning on the last line in the screen, that gets immediatelly rewritten :-\ I am applying it, as it improves the --stdio case, and will fix this in a way that works for all UIs, with some strerror() interface to convert whatever error happened to a string that then gets used in whatever UI is being used. Thanks, - Arnaldo > Signed-off-by: Andi Kleen > --- > 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 d1eece7..07f9544 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -1081,6 +1081,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); > @@ -1176,6 +1177,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); > > @@ -1201,13 +1205,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. > -- > 2.4.3