[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191017134526.097f1490@gandalf.local.home>
Date: Thu, 17 Oct 2019 13:45:26 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
Cc: Tzvetomir Stoyanov <tstoyanov@...are.com>,
Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] libtraceevent: perf script -g python segfaults
On Thu, 17 Oct 2019 12:42:05 -0300
Arnaldo Carvalho de Melo <arnaldo.melo@...il.com> wrote:
> I'll try and continue later, but if you guys can take a look...
>
> The first call in that loop:
>
> while ((event = trace_find_next_event(pevent, event)))
>
> works and the event is valid, one of the sched: tracepoints, but then
> the next call returns this:
>
> struct tep_event *trace_find_next_event(struct tep_handle *pevent,
> struct tep_event *event)
> {
> static int idx;
> int events_count;
> struct tep_event *all_events;
>
> all_events = tep_get_first_event(pevent);
> events_count = tep_get_events_count(pevent);
> if (!pevent || !all_events || events_count < 1)
> return NULL;
>
> if (!event) {
> idx = 0;
> return all_events;
> }
>
> if (idx < events_count && event == (all_events + idx)) {
> idx++;
> if (idx == events_count)
> return NULL;
> return (all_events + idx);
> }
>
> for (idx = 1; idx < events_count; idx++) {
> if (event == (all_events + (idx - 1)))
> return (all_events + idx);
> }
> return NULL;
> }
>
> Oh, static int idx, oops, anyway, the all_events + idx returned for the
> second call to trace_find_next_event() fails, in a hurry now, will get
> back to this later.
Yeah, this is obviously broken. :-(
I'll have a patch later today.
-- Steve
Powered by blists - more mailing lists