tracefile.c: Seek fix
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 25 Nov 2010 15:04:27 +0000 (10:04 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Thu, 25 Nov 2010 15:04:27 +0000 (10:04 -0500)
commitcaa44fe6ed9d848a52f712fbe900ad3e932d7da4
tree49eee2bd277fefd4eefbca97a7b0d88aa19e3017
parent4011932e905b1b98f5b96f55d0cf0f6206b347b2
tracefile.c: Seek fix

Made the tracefile.c seek more robust. Fixes a rare crash where high can be
lower than low in a seek.

Matthew Khouzam <matthew.khouzam@ericsson.com>:
I am including an example to better illustrace my fix.
the current binary search has a case where high can be lower then low.
An example: 51 blocks, the element is somewhere in the 12th block.
trace of before :
 low : 0, high 51 , block_num -1
 low : 0, high 24 , block_num 25
 low : 13, high 24 , block_num 12
 low : 13, high 17 , block_num 18
 low : 13, high 14 , block_num 15
 low : 13, high 12 , block_num 13
This will assert and fail.
The trace after will produce the following walkthrough
 low : 0, high 51 , block_num -1
 low : 0, high 24 , block_num 25
 low : 0, high 24 , block_num 12
 Found!

Reported-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt/tracefile.c
This page took 0.023901 seconds and 4 git commands to generate.