On Mon, 8 Jan 2024 11:11:29 +0000 Vincent Donnefort <vdonnefort@xxxxxxxxxx> wrote: > Yeah it seems that the update_pointers() is not enough. > > kbuffer_next_event(kbuf, NULL) will make sure curr is also up to date and will > do the update until an event type we can read. With that change I don't see any > spurious "mmiotrace_rw" on the output. Ah you're right. Try this. -- Steve diff --git a/src/kbuffer-parse.c b/src/kbuffer-parse.c index 1e1d168..5651797 100644 --- a/src/kbuffer-parse.c +++ b/src/kbuffer-parse.c @@ -180,6 +180,7 @@ static int calc_index(struct kbuffer *kbuf, void *ptr) return (unsigned long)ptr - (unsigned long)kbuf->data; } +static int next_event(struct kbuffer *kbuf); static int __next_event(struct kbuffer *kbuf); /* @@ -323,12 +324,8 @@ int kbuffer_refresh(struct kbuffer *kbuf) kbuf->size = (unsigned int)flags & COMMIT_MASK; /* Update next to be the next element */ - if (kbuf->size != old_size && kbuf->curr == old_size) { - if (kbuf->flags & KBUFFER_FL_OLD_FORMAT) - old_update_pointers(kbuf); - else - update_pointers(kbuf); - } + if (kbuf->size != old_size && kbuf->curr == kbuf->next) + next_event(kbuf); return 0; }