aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/event.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2010-05-09 20:14:07 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2010-05-09 20:14:07 -0400
commit4cc4945844fe2cf493f1783b6ce938ba1617d5c2 (patch)
treed4d94f2f4447acf93473ec47de1ef5851fca9f00 /tools/perf/util/event.c
parent3ceb0d4438876a65606c258e5d69e03e57460dd6 (diff)
perf symbols: Check if a struct machine instance was found
Which can happen when processing old files that had no fake kernel MMAP, events. That shouldn't result in perf_session__create_kernel_maps not being called, this will be fixed in a followup patch, for now do these checks to avoid segfaulting. Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Tom Zanussi <tzanussi@gmail.com> LKML-Reference: <new-submission> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/event.c')
-rw-r--r--tools/perf/util/event.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 46563e16c3f5..dfc8bf64d70f 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -493,8 +493,10 @@ int event__process_mmap(event_t *self, struct perf_session *session)
493 return 0; 493 return 0;
494 } 494 }
495 495
496 thread = perf_session__findnew(session, self->mmap.pid);
497 machine = perf_session__find_host_machine(session); 496 machine = perf_session__find_host_machine(session);
497 if (machine == NULL)
498 goto out_problem;
499 thread = perf_session__findnew(session, self->mmap.pid);
498 map = map__new(&machine->user_dsos, self->mmap.start, 500 map = map__new(&machine->user_dsos, self->mmap.start,
499 self->mmap.len, self->mmap.pgoff, 501 self->mmap.len, self->mmap.pgoff,
500 self->mmap.pid, self->mmap.filename, 502 self->mmap.pid, self->mmap.filename,
@@ -552,6 +554,10 @@ void thread__find_addr_map(struct thread *self,
552 if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) { 554 if (cpumode == PERF_RECORD_MISC_KERNEL && perf_host) {
553 al->level = 'k'; 555 al->level = 'k';
554 machine = perf_session__find_host_machine(session); 556 machine = perf_session__find_host_machine(session);
557 if (machine == NULL) {
558 al->map = NULL;
559 return;
560 }
555 mg = &machine->kmaps; 561 mg = &machine->kmaps;
556 } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) { 562 } else if (cpumode == PERF_RECORD_MISC_USER && perf_host) {
557 al->level = '.'; 563 al->level = '.';
@@ -559,7 +565,7 @@ void thread__find_addr_map(struct thread *self,
559 } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) { 565 } else if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL && perf_guest) {
560 al->level = 'g'; 566 al->level = 'g';
561 machine = perf_session__find_machine(session, pid); 567 machine = perf_session__find_machine(session, pid);
562 if (!machine) { 568 if (machine == NULL) {
563 al->map = NULL; 569 al->map = NULL;
564 return; 570 return;
565 } 571 }