aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-23 18:12:25 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-23 21:35:07 -0400
commit44bf460649a9b91f291176097e9d7e846e8c001e (patch)
tree9ae7d7df29e058fc43e9ca8cee25ff9fc19a0973 /tools/perf
parentc392c4c6dccf7c64c113b473c7eceedf25eddd51 (diff)
perf annotate: Fix up usage of the build id cache
It was assuming that the cache was always available and also wasn't checking if the file found in the build id cache was just a kallsyms file, that is not supported by objdump for disassembly. Reported-by: Ingo Molnar <mingo@elte.hu> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/hist.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 682a6d88862c..cbf7eae2ce09 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -990,6 +990,7 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
990 struct map *map = self->ms.map; 990 struct map *map = self->ms.map;
991 struct dso *dso = map->dso; 991 struct dso *dso = map->dso;
992 char *filename = dso__build_id_filename(dso, NULL, 0); 992 char *filename = dso__build_id_filename(dso, NULL, 0);
993 bool free_filename = true;
993 char command[PATH_MAX * 2]; 994 char command[PATH_MAX * 2];
994 FILE *file; 995 FILE *file;
995 int err = 0; 996 int err = 0;
@@ -1001,11 +1002,19 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
1001 sym->name); 1002 sym->name);
1002 return -ENOMEM; 1003 return -ENOMEM;
1003 } 1004 }
1005 goto fallback;
1006 } else if (readlink(filename, command, sizeof(command)) < 0 ||
1007 strstr(command, "[kernel.kallsyms]") ||
1008 access(filename, R_OK)) {
1009 free(filename);
1010fallback:
1004 /* 1011 /*
1005 * If we don't have build-ids, well, lets hope that this 1012 * If we don't have build-ids or the build-id file isn't in the
1013 * cache, or is just a kallsyms file, well, lets hope that this
1006 * DSO is the same as when 'perf record' ran. 1014 * DSO is the same as when 'perf record' ran.
1007 */ 1015 */
1008 filename = dso->long_name; 1016 filename = dso->long_name;
1017 free_filename = false;
1009 } 1018 }
1010 1019
1011 if (dso->origin == DSO__ORIG_KERNEL) { 1020 if (dso->origin == DSO__ORIG_KERNEL) {
@@ -1045,7 +1054,7 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head)
1045 1054
1046 pclose(file); 1055 pclose(file);
1047out_free_filename: 1056out_free_filename:
1048 if (dso->has_build_id) 1057 if (free_filename)
1049 free(filename); 1058 free(filename);
1050 return err; 1059 return err;
1051} 1060}