aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2012-10-20 12:08:46 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-21 21:07:36 -0400
commitfc551f8d4427150da1ee7cbb0f53525c49ef4bca (patch)
tree87aaf6b20a79fb2b87e5e7bac2f138f9a7738444 /tools
parent3a531260a14631ae8d231279b8738884bf808e7b (diff)
perf trace: Check if sample raw_data field is set
Sometimes we're segfaulting because we were expecting that the perf_sample.raw_data field was set as requested, but in some cases that needs further investigation, that field can be NULL, leading to segfaults. Make the tool more robust by checking that before calling any per event handlers that may try to use that field. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-g1fmodl6ys4lq8honbj1igoi@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-trace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 83c6515e425d..7aaee39f6774 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -268,6 +268,13 @@ again:
268 if (evlist->threads->map[0] == -1 || evlist->threads->nr > 1) 268 if (evlist->threads->map[0] == -1 || evlist->threads->nr > 1)
269 printf("%d ", sample.tid); 269 printf("%d ", sample.tid);
270 270
271 if (sample.raw_data == NULL) {
272 printf("%s sample with no payload for tid: %d, cpu %d, raw_size=%d, skipping...\n",
273 perf_evsel__name(evsel), sample.tid,
274 sample.cpu, sample.raw_size);
275 continue;
276 }
277
271 handler = evsel->handler.func; 278 handler = evsel->handler.func;
272 handler(trace, evsel, &sample); 279 handler(trace, evsel, &sample);
273 } 280 }