aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-07-05 01:39:17 -0400
committerIngo Molnar <mingo@elte.hu>2009-07-05 04:30:21 -0400
commit91b4eaea93f5be95f4477554399680a53aff2343 (patch)
tree2a78d12b0798f5ed6e726ccc11f476807bf85088 /tools/perf
parenta79f0da80a508448434476b77f9d3d1a469eab67 (diff)
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: Jens Axboe <jens.axboe@oracle.com> Reported-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Frederic 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: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-report.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index fa937f5c3c3..9f9575afab0 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -1684,9 +1684,19 @@ static int __cmd_report(void)
1684 1684
1685 sample_type = perf_header__sample_type(); 1685 sample_type = perf_header__sample_type();
1686 1686
1687 if (sort__has_parent && !(sample_type & PERF_SAMPLE_CALLCHAIN)) { 1687 if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) {
1688 fprintf(stderr, "selected --sort parent, but no callchain data\n"); 1688 if (sort__has_parent) {
1689 exit(-1); 1689 fprintf(stderr, "selected --sort parent, but no"
1690 " callchain data. Did you call"
1691 " perf record without -g?\n");
1692 exit(-1);
1693 }
1694 if (callchain) {
1695 fprintf(stderr, "selected -c but no callchain data."
1696 " Did you call perf record without"
1697 " -g?\n");
1698 exit(-1);
1699 }
1690 } 1700 }
1691 1701
1692 if (load_kernel() < 0) { 1702 if (load_kernel() < 0) {