From: tip-bot for Tom Zanussi <tom.zanussi@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, tglx@linutronix.de,
tom.zanussi@linux.intel.com
Subject: [tip:perf/core] perf script: hook up perf_scripting_context-> pevent
Date: Fri, 25 Jan 2013 04:10:36 -0800 [thread overview]
Message-ID: <tip-2de9533d6d61d3086a7079bf142d2bfa374e664e@git.kernel.org> (raw)
In-Reply-To: <d2b1b8166a6ca0a36e1f5255b88a8289058ba236.1358527965.git.tom.zanussi@linux.intel.com>
Commit-ID: 2de9533d6d61d3086a7079bf142d2bfa374e664e
Gitweb: http://git.kernel.org/tip/2de9533d6d61d3086a7079bf142d2bfa374e664e
Author: Tom Zanussi <tom.zanussi@linux.intel.com>
AuthorDate: Fri, 18 Jan 2013 13:51:27 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 24 Jan 2013 16:40:52 -0300
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>
---
tools/perf/util/scripting-engines/trace-event-perl.c | 1 +
tools/perf/util/scripting-engines/trace-event-python.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index f80605e..eacec85 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,
ns = nsecs - s * NSECS_PER_SEC;
scripting_context->event_data = data;
+ scripting_context->pevent = evsel->tp_format->pevent;
ENTER;
SAVETMPS;
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 14683df..e87aa5d 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
ns = nsecs - s * NSECS_PER_SEC;
scripting_context->event_data = data;
+ scripting_context->pevent = evsel->tp_format->pevent;
context = PyCObject_FromVoidPtr(scripting_context, NULL);
next prev parent reply other threads:[~2013-01-25 12:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 19:51 [PATCH 0/4] perf tools: some 'perf script' fixes Tom Zanussi
2013-01-18 19:51 ` [PATCH 1/4] perf/tools: reinstate 'signed' field flag for tracepoints Tom Zanussi
2013-01-25 12:08 ` [tip:perf/core] perf tools: Reinstate " tip-bot for Tom Zanussi
2013-01-18 19:51 ` [PATCH 2/4] perf script: don't display trace info when invoking scripts Tom Zanussi
2013-01-25 12:09 ` [tip:perf/core] perf script: Don' t " tip-bot for Tom Zanussi
2013-01-18 19:51 ` [PATCH 3/4] perf tools: hook up perf_scripting_context->pevent Tom Zanussi
2013-01-25 12:10 ` tip-bot for Tom Zanussi [this message]
2013-01-18 19:51 ` [PATCH 4/4] perf script: remove workqueue-stats script Tom Zanussi
2013-01-25 12:11 ` [tip:perf/core] perf script: Remove " tip-bot for Tom Zanussi
2013-01-24 18:27 ` [PATCH 0/4] perf tools: some 'perf script' fixes Arnaldo Carvalho de Melo
2013-01-24 18:44 ` David Ahern
2013-01-24 20:33 ` Tom Zanussi
2013-01-24 20:58 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-2de9533d6d61d3086a7079bf142d2bfa374e664e@git.kernel.org \
--to=tom.zanussi@linux.intel.com \
--cc=acme@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox