aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2015-11-05 22:06:07 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-11-06 08:20:48 -0500
commit62ec9b3f02a9bccaf699bd4691db98f779c3075f (patch)
tree304607c77ef4d6cb3defc5bae0744ffbac5034b0
parente0547311133159bf95f7998726e4e4932d78d8ce (diff)
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 <ak@linux.intel.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Link: http://lkml.kernel.org/r/1446779167-18949-1-git-send-email-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/annotate.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 0fc8d7a2fea5..f2974da0185a 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)
1084 struct kcore_extract kce; 1084 struct kcore_extract kce;
1085 bool delete_extract = false; 1085 bool delete_extract = false;
1086 int lineno = 0; 1086 int lineno = 0;
1087 int nline;
1087 1088
1088 if (filename) 1089 if (filename)
1089 symbol__join_symfs(symfs_filename, filename); 1090 symbol__join_symfs(symfs_filename, filename);
@@ -1179,6 +1180,9 @@ fallback:
1179 1180
1180 ret = decompress_to_file(m.ext, symfs_filename, fd); 1181 ret = decompress_to_file(m.ext, symfs_filename, fd);
1181 1182
1183 if (ret)
1184 pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename);
1185
1182 free(m.ext); 1186 free(m.ext);
1183 close(fd); 1187 close(fd);
1184 1188
@@ -1204,13 +1208,25 @@ fallback:
1204 pr_debug("Executing: %s\n", command); 1208 pr_debug("Executing: %s\n", command);
1205 1209
1206 file = popen(command, "r"); 1210 file = popen(command, "r");
1207 if (!file) 1211 if (!file) {
1212 pr_err("Failure running %s\n", command);
1213 /*
1214 * If we were using debug info should retry with
1215 * original binary.
1216 */
1208 goto out_remove_tmp; 1217 goto out_remove_tmp;
1218 }
1209 1219
1210 while (!feof(file)) 1220 nline = 0;
1221 while (!feof(file)) {
1211 if (symbol__parse_objdump_line(sym, map, file, privsize, 1222 if (symbol__parse_objdump_line(sym, map, file, privsize,
1212 &lineno) < 0) 1223 &lineno) < 0)
1213 break; 1224 break;
1225 nline++;
1226 }
1227
1228 if (nline == 0)
1229 pr_err("No output from %s\n", command);
1214 1230
1215 /* 1231 /*
1216 * kallsyms does not have symbol sizes so there may a nop at the end. 1232 * kallsyms does not have symbol sizes so there may a nop at the end.