Skip to content

Commit

Permalink
perf annotate: Show better message when no vmlinux is found
Browse files Browse the repository at this point in the history
In both --tui and --stdio, in 'annotate', 'top', 'report' when trying to
annotate a kernel symbol having just access to a kallsyms file, that
doesn't have the DWARF info needed for annotation.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
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>
  • Loading branch information
Arnaldo Carvalho de Melo committed Feb 23, 2011
1 parent 9848caf commit 170ae6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 13 additions & 2 deletions tools/perf/util/annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,23 @@ int symbol__annotate(struct symbol *sym, struct map *map, size_t privsize)
}

if (dso->origin == DSO__ORIG_KERNEL) {
char bf[BUILD_ID_SIZE * 2 + 16] = " with build id ";
char *build_id_msg = NULL;

if (dso->annotate_warned)
goto out_free_filename;

if (dso->has_build_id) {
build_id__sprintf(dso->build_id,
sizeof(dso->build_id), bf + 15);
build_id_msg = bf;
}
err = -ENOENT;
dso->annotate_warned = 1;
pr_err("Can't annotate %s: No vmlinux file was found in the "
"path\n", sym->name);
pr_err("Can't annotate %s: No vmlinux file%s was found in the "
"path.\nPlease use 'perf buildid-cache -av vmlinux' or "
"--vmlinux vmlinux.\n",
sym->name, build_id_msg ?: "");
goto out_free_filename;
}

Expand Down
8 changes: 0 additions & 8 deletions tools/perf/util/ui/browsers/hists.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,14 +924,6 @@ int hists__browse(struct hists *self, const char *helpline,
if (choice == annotate) {
struct hist_entry *he;
do_annotate:
if (browser->selection->map->dso->origin == DSO__ORIG_KERNEL) {
browser->selection->map->dso->annotate_warned = 1;
ui_helpline__puts("No vmlinux file found, can't "
"annotate with just a "
"kallsyms file");
continue;
}

he = hist_browser__selected_entry(browser);
if (he == NULL)
continue;
Expand Down

0 comments on commit 170ae6b

Please sign in to comment.