diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-01-27 18:05:49 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-01-29 03:20:57 -0500 |
commit | 72b8fa1730207274f6818b47b891ce5dff79287e (patch) | |
tree | cc8fd9f816c3a3b9f251c9507f72bf9860b6b601 | |
parent | 75c9f3284a7ff957829f44baace82406a6354ceb (diff) |
perf top: Exit if specified --vmlinux can't be used
As we do lazy loading of symtabs we only will know if the
specified vmlinux file is invalid when we actually have a hit in
kernel space and then try to load it. So if we get kernel hits
and there are _no_ symbols in the DSO backing the kernel map,
bail out.
Reported-by: Mike Galbraith <efault@gmx.de>
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>
LKML-Reference: <1264633557-17597-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | tools/perf/builtin-top.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 2227b84aa002..78f9c4576a0c 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -951,9 +951,31 @@ static void event__process_sample(const event_t *self, | |||
951 | } | 951 | } |
952 | 952 | ||
953 | if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 || | 953 | if (event__preprocess_sample(self, session, &al, symbol_filter) < 0 || |
954 | al.sym == NULL || al.filtered) | 954 | al.filtered) |
955 | return; | 955 | return; |
956 | 956 | ||
957 | if (al.sym == NULL) { | ||
958 | /* | ||
959 | * As we do lazy loading of symtabs we only will know if the | ||
960 | * specified vmlinux file is invalid when we actually have a | ||
961 | * hit in kernel space and then try to load it. So if we get | ||
962 | * here and there are _no_ symbols in the DSO backing the | ||
963 | * kernel map, bail out. | ||
964 | * | ||
965 | * We may never get here, for instance, if we use -K/ | ||
966 | * --hide-kernel-symbols, even if the user specifies an | ||
967 | * invalid --vmlinux ;-) | ||
968 | */ | ||
969 | if (al.map == session->vmlinux_maps[MAP__FUNCTION] && | ||
970 | RB_EMPTY_ROOT(&al.map->dso->symbols[MAP__FUNCTION])) { | ||
971 | pr_err("The %s file can't be used\n", | ||
972 | symbol_conf.vmlinux_name); | ||
973 | exit(1); | ||
974 | } | ||
975 | |||
976 | return; | ||
977 | } | ||
978 | |||
957 | syme = symbol__priv(al.sym); | 979 | syme = symbol__priv(al.sym); |
958 | if (!syme->skip) { | 980 | if (!syme->skip) { |
959 | syme->count[counter]++; | 981 | syme->count[counter]++; |