diff options
author | Tom Zanussi <tom.zanussi@linux.intel.com> | 2013-01-18 14:51:27 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-01-24 14:40:52 -0500 |
commit | 2de9533d6d61d3086a7079bf142d2bfa374e664e (patch) | |
tree | 1fa6de34d2f4d14ebb9170aa56d9944d3d9a0ef3 /tools/perf/util | |
parent | bdb71db29d50b61f45459b8facfb876768e8cacc (diff) |
perf script: hook up perf_scripting_context->pevent
Running the check-perf-trace scripts causes segfaults in both the Perl
and Python cases:
# perf script record check-perf-trace
# perf script -s libexec/perf-core/scripts/python/check-perf-trace.py
trace_begin
Segmentation fault (core dumped)
The reason is that the 'pevent' field was added to
perf_scripting_context but it wasn't hooked up with an actual pevent in
either case, so when one of the 'common' fields is accessed (in
util/trace-event-parse.c:get_common_fields()), pevent->events tries to
dereference a NULL pointer.
This sets the pevent field when the scripting context is set up.
Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
Link: http://lkml.kernel.org/r/d2b1b8166a6ca0a36e1f5255b88a8289058ba236.1358527965.git.tom.zanussi@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 1 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index f80605eb1855..eacec859f299 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -292,6 +292,7 @@ static void perl_process_tracepoint(union perf_event *perf_event __maybe_unused, | |||
292 | ns = nsecs - s * NSECS_PER_SEC; | 292 | ns = nsecs - s * NSECS_PER_SEC; |
293 | 293 | ||
294 | scripting_context->event_data = data; | 294 | scripting_context->event_data = data; |
295 | scripting_context->pevent = evsel->tp_format->pevent; | ||
295 | 296 | ||
296 | ENTER; | 297 | ENTER; |
297 | SAVETMPS; | 298 | SAVETMPS; |
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 14683dfca2ee..e87aa5d9696b 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -265,6 +265,7 @@ static void python_process_tracepoint(union perf_event *perf_event | |||
265 | ns = nsecs - s * NSECS_PER_SEC; | 265 | ns = nsecs - s * NSECS_PER_SEC; |
266 | 266 | ||
267 | scripting_context->event_data = data; | 267 | scripting_context->event_data = data; |
268 | scripting_context->pevent = evsel->tp_format->pevent; | ||
268 | 269 | ||
269 | context = PyCObject_FromVoidPtr(scripting_context, NULL); | 270 | context = PyCObject_FromVoidPtr(scripting_context, NULL); |
270 | 271 | ||