aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-03-15 12:04:33 -0400
committerIngo Molnar <mingo@elte.hu>2010-03-15 12:16:25 -0400
commitd06d92b7c9b99ea52bdaeb13f544675529891b8a (patch)
treeeb8bb2979883cecd6af007cab9e10dc83a0dfd3a /tools/perf
parentb0a9ab62ab96e258a0ddd81d7fe2719c3db36006 (diff)
perf annotate: Properly notify the user that vmlinux is missing
Before this patch we would not find a vmlinux, then try to pass objdump "[kernel.kallsyms]" as the filename, it would get confused and produce no output: [root@doppio ~]# perf annotate n_tty_write ------------------------------------------------ Percent | Source code & Disassembly of [kernel.kallsyms] ------------------------------------------------ Now we check that and emit meaningful warning: [root@doppio ~]# perf annotate n_tty_write Can't annotate n_tty_write: No vmlinux file was found in the path: [0] vmlinux [1] /boot/vmlinux [2] /boot/vmlinux-2.6.34-rc1-tip+ [3] /lib/modules/2.6.34-rc1-tip+/build/vmlinux [4] /usr/lib/debug/lib/modules/2.6.34-rc1-tip+/vmlinux [root@doppio ~]# This bug was introduced when we added automatic search for vmlinux, before that time the user had to specify a vmlinux file. v2: Print the warning just for the first symbol found when no symbol name is specified, otherwise it will spam the screen repeating the warning for each symbol. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: <stable@kernel.org> LKML-Reference: <1268669073-6856-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-annotate.c10
-rw-r--r--tools/perf/util/newt.c2
-rw-r--r--tools/perf/util/symbol.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 6ad7148451c5..45d14660d53d 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -452,6 +452,16 @@ static void annotate_sym(struct hist_entry *he)
452 if (!filename) 452 if (!filename)
453 return; 453 return;
454 454
455 if (dso->origin == DSO__ORIG_KERNEL) {
456 if (dso->annotate_warned)
457 return;
458 dso->annotate_warned = 1;
459 pr_err("Can't annotate %s: No vmlinux file was found in the "
460 "path:\n", sym->name);
461 vmlinux_path__fprintf(stderr);
462 return;
463 }
464
455 pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__, 465 pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__,
456 filename, sym->name, map->unmap_ip(map, sym->start), 466 filename, sym->name, map->unmap_ip(map, sym->start),
457 map->unmap_ip(map, sym->end)); 467 map->unmap_ip(map, sym->end));
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index 2836394459d9..2d19e7a3e6e8 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -63,7 +63,7 @@ static void hist_entry__annotate_browser(struct hist_entry *self)
63 if (self->sym == NULL) 63 if (self->sym == NULL)
64 return; 64 return;
65 65
66 if (asprintf(&str, "perf annotate %s | expand", self->sym->name) < 0) 66 if (asprintf(&str, "perf annotate %s 2>&1 | expand", self->sym->name) < 0)
67 return; 67 return;
68 68
69 fp = popen(str, "r"); 69 fp = popen(str, "r");
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index d983bbaf99c5..5bd91d142704 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -106,6 +106,7 @@ struct dso {
106 u8 has_build_id:1; 106 u8 has_build_id:1;
107 u8 kernel:1; 107 u8 kernel:1;
108 u8 hit:1; 108 u8 hit:1;
109 u8 annotate_warned:1;
109 unsigned char origin; 110 unsigned char origin;
110 u8 sorted_by_name; 111 u8 sorted_by_name;
111 u8 loaded; 112 u8 loaded;