From 78ee529de330c2ec06068a9e158561c275ae9e75 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Sun, 23 May 2010 19:12:25 -0300 Subject: [PATCH] --- yaml --- r: 199151 b: refs/heads/master c: 44bf460649a9b91f291176097e9d7e846e8c001e h: refs/heads/master i: 199149: 9004a8aba97f6f34dcdbfc42271a0058e0c92e5c 199147: 384db875d48a9f5939f7cb184899b4eca5590bec 199143: 99c4cd216b2c856b238d21d37b24ec91971f5d35 199135: b944a8585cf3a23ad910d246e7c07b42ff218cb9 v: v3 --- [refs] | 2 +- trunk/tools/perf/util/hist.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index c4a0e43c4ffa..7758352ccf35 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c392c4c6dccf7c64c113b473c7eceedf25eddd51 +refs/heads/master: 44bf460649a9b91f291176097e9d7e846e8c001e diff --git a/trunk/tools/perf/util/hist.c b/trunk/tools/perf/util/hist.c index 682a6d88862c..cbf7eae2ce09 100644 --- a/trunk/tools/perf/util/hist.c +++ b/trunk/tools/perf/util/hist.c @@ -990,6 +990,7 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) struct map *map = self->ms.map; struct dso *dso = map->dso; char *filename = dso__build_id_filename(dso, NULL, 0); + bool free_filename = true; char command[PATH_MAX * 2]; FILE *file; int err = 0; @@ -1001,11 +1002,19 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) sym->name); return -ENOMEM; } + goto fallback; + } else if (readlink(filename, command, sizeof(command)) < 0 || + strstr(command, "[kernel.kallsyms]") || + access(filename, R_OK)) { + free(filename); +fallback: /* - * If we don't have build-ids, well, lets hope that this + * If we don't have build-ids or the build-id file isn't in the + * cache, or is just a kallsyms file, well, lets hope that this * DSO is the same as when 'perf record' ran. */ filename = dso->long_name; + free_filename = false; } if (dso->origin == DSO__ORIG_KERNEL) { @@ -1045,7 +1054,7 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) pclose(file); out_free_filename: - if (dso->has_build_id) + if (free_filename) free(filename); return err; }