]> git.baikalelectronics.ru Git - kernel.git/commit
perf script: Fix segfault using --show-mmap-events
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 20 Aug 2015 08:26:45 +0000 (11:26 +0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 21 Aug 2015 13:29:22 +0000 (10:29 -0300)
commit18160aa478867cccf6abedcc123af498a1a6912b
tree2c749cd6f9ffdce0295e2f37f6f878e89618bbd6
parent57a7b8d0cbc011a66ce5e977715e58771c3097d9
perf script: Fix segfault using --show-mmap-events

Patch "perf script: Don't assume evsel position of tracking events"
changed 'perf script' to use 'perf_evlist__id2evsel()'. That results
in a segfault if there is more than 1 event and there are
synthesized mmap events e.g.

$ perf record -e cycles,instructions -p$$ sleep 1
$ perf script --show-mmap-events
Segmentation fault (core dumped)

That happens because these synthesized events have an 'id' of zero
which does not match any 'evsel'.

Currently, these synthesized events use the sample type of the first
evsel.

Change 'perf_evlist__id2evsel()' to reflect that which also makes
it consistent with 'perf_evlist__event2evsel()'.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 8c570f106d54 ("perf script: Don't assume evsel position of tracking events")
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1440059205-1765-1-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evlist.c