API problem with bt_iter_set_pos
Reported by Francis Deslauriers
program to trigger the bug :
git clone -b seektest git://git.dorsal.polymtl.ca/~fdeslauriers/babeltrace-api-test/.git
trace to trigger the bug :
The test program iterates over the trace, it does the following in loop until there are no more events :
- save the position of the iterator
- read 2 events
- restore the position of the iterator
- read 1 event
So each event is saved and restored once.
At the end of this trace, it seems that we cannot get past the last event of CPU 7 (103572.478927352) even though there are other events in other streams.
For the other streams, when a stream has no more events, its "current" timestamp is the timestamp of destruction of the buffer which is far in the future.
But in this particular scenario, it seems that we never get past the current event. When we save the position, we record the timestamp of this event, so everytime we restore to the next event, this one is also restored and since it has the smallest timestamp and it gets processed, endlessly...