Re: [PATCH] event: fix TP_printk() argument in sched_switch

Steven Rostedt
2011-11-03T14:15:38Z

On Thu, 2011-11-03 at 16:57 +0400, Andrew Vagin wrote:
> > NACK!
> >
> > This is a perf userspace bug, not a kernel one. Please fix the userspace
> > tool instead.
> >
> > Note, the new version of libparsevent handles this case without issue.
> > Perf just needs to be updated.
> I don't understand. I've got
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
> and it reports the same error. Where am I wrong?
>
> # ./trace-cmd report 2> log
>
> <idle>-0 [001] 1516333.292126: sched_switch: [FAILED TO
> PARSE] prev_comm=kworker/0:0 prev_pid=0 prev_prio=120 prev_state=0x0
> next_comm=trace-cmd next_pid=2900 next_prio=120
>
> # cat log
> trace-cmd: No such file or directory
> Error: expected type 5 but read 4
> Error: expected type 4 but read 0
> failed to read event print fmt for sched_switch
> trace-cmd: Received SIGINT

Add the below patch to trace-cmd and see if it fixes the issue. I'll
start working on something that fixes perf too.

Thanks,

-- Steve

diff --git a/parse-events.c b/parse-events.c
index 2dbd47b..8ed018d 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -2167,6 +2167,10 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
field = alloc_arg();

type = process_arg(event, field, &token);
+ /* Handle operations in the first argument */
+ while (type == EVENT_OP) {
+ type = process_op(event, field, &token);
+ }
if (test_type_token(type, token, EVENT_DELIM, ","))
goto out_free;
free_token(token);