Breakpad processor: Have RetrieveNearestRange correctly return range extent.
RangeMaps use the range's upper end as the key in the underlying map, but RetrieveNearestRange was treating the key as the lower end. a=jimblandy, r=mmentovai git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@501 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
parent
057aa1f617
commit
97f1da43ae
@ -156,7 +156,7 @@ bool RangeMap<AddressType, EntryType>::RetrieveNearestRange(
|
||||
|
||||
*entry = iterator->second.entry();
|
||||
if (entry_base)
|
||||
*entry_base = iterator->first;
|
||||
*entry_base = iterator->second.base();
|
||||
if (entry_size)
|
||||
*entry_size = iterator->first - iterator->second.base() + 1;
|
||||
|
||||
|
@ -210,10 +210,11 @@ static bool RetrieveTest(TestMap *range_map, const RangeTest *range_test) {
|
||||
|
||||
linked_ptr<CountedObject> nearest_object;
|
||||
AddressType nearest_base;
|
||||
AddressType nearest_size;
|
||||
bool retrieved_nearest = range_map->RetrieveNearestRange(address,
|
||||
&nearest_object,
|
||||
&nearest_base,
|
||||
NULL);
|
||||
&nearest_size);
|
||||
|
||||
// When checking one greater than the high side, RetrieveNearestRange
|
||||
// should usually return the test range. When a different range begins
|
||||
@ -237,6 +238,22 @@ static bool RetrieveTest(TestMap *range_map, const RangeTest *range_test) {
|
||||
observed_nearest ? "true" : "false");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If a range was successfully retrieved, check that the returned
|
||||
// bounds match the range as stored.
|
||||
if (expected_nearest &&
|
||||
(nearest_base != range_test->address ||
|
||||
nearest_size != range_test->size)) {
|
||||
fprintf(stderr, "FAILED: "
|
||||
"RetrieveNearestRange id %d, side %d, offset %d, "
|
||||
"expected base/size %d/%d, observed %d/%d\n",
|
||||
range_test->id,
|
||||
side,
|
||||
offset,
|
||||
range_test->address, range_test->size,
|
||||
nearest_base, nearest_size);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user