Commit 91b4eaea authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Ingo Molnar

perf report: Warn on callchain output request from non-callchain file

perf report segfaults while trying to handle callchains from a non
callchain data file.

Instead of a segfault, print a useful message to the user.
Reported-by: default avatarJens Axboe <jens.axboe@oracle.com>
Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1246772361-9960-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent a79f0da8
...@@ -1684,9 +1684,19 @@ static int __cmd_report(void) ...@@ -1684,9 +1684,19 @@ static int __cmd_report(void)
sample_type = perf_header__sample_type(); sample_type = perf_header__sample_type();
if (sort__has_parent && !(sample_type & PERF_SAMPLE_CALLCHAIN)) { if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) {
fprintf(stderr, "selected --sort parent, but no callchain data\n"); if (sort__has_parent) {
exit(-1); fprintf(stderr, "selected --sort parent, but no"
" callchain data. Did you call"
" perf record without -g?\n");
exit(-1);
}
if (callchain) {
fprintf(stderr, "selected -c but no callchain data."
" Did you call perf record without"
" -g?\n");
exit(-1);
}
} }
if (load_kernel() < 0) { if (load_kernel() < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment