lib tools traceevent: Add back pevent assignment in __pevent_parse_format()
authorSteven Rostedt <rostedt@goodmis.org>
Tue, 2 Oct 2012 00:13:51 +0000 (20:13 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 16 Oct 2012 16:06:36 +0000 (13:06 -0300)
commit101782ea2c6984cf169631c59df76b8497899caf
tree500c3a43f6698e1b42b093a576eaefc8ea934504
parent63a1a3d820c619a4dab1781cc16c110a284efded
lib tools traceevent: Add back pevent assignment in __pevent_parse_format()

Even though with the change of commit commit 2b29175 "tools lib
traceevent: Carve out events format parsing routine", allowed
__pevent_parse_format() to parse an event without the need of a pevent
handler, the event still needs to assign the pevent handed to it.

There's no problem with assigning it if the pevent is NULL, as the
event->pevent would be NULL without the assignment. But function parsing
handlers may be assigned to the pevent handler to help in parsing the
event. If there's no pevent then there would not be any function
handlers, but if the pevent isn't assigned first before parsing the
event, it wont honor the function handlers that were assigned.

Worse yet, the current code crashes if an event has a function that it
tries to parse. For example:

 # perf record -e scsi:scsi_dispatch_cmd_timeout
 Segmentation fault (core dumped)

This happens because the scsi_dispatch_cmd_timeout event format has the following:

  scsi_trace_parse_cdb(p, __get_dynamic_array(cmnd), REC->cmd_len)

which hasn't been defined by the pevent code.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1349136831.22822.133.camel@gandalf.local.home
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/lib/traceevent/event-parse.c