Silently ignore duplicate heap entries

am: cecd64012d

* commit 'cecd64012db013331ff1071254ab543dcdf327bd':
  Silently ignore duplicate heap entries

Change-Id: I67edc2bdedbd28bf4b11a071e132ae213d143bc1
This commit is contained in:
Colin Cross 2016-04-29 00:15:22 +00:00 committed by android-build-merger
commit 9a99578573
2 changed files with 13 additions and 5 deletions

View File

@ -41,11 +41,13 @@ bool HeapWalker::Allocation(uintptr_t begin, uintptr_t end) {
return true;
} else {
Range overlap = inserted.first->first;
ALOGE("range %p-%p overlaps with existing range %p-%p",
reinterpret_cast<void*>(begin),
reinterpret_cast<void*>(end),
reinterpret_cast<void*>(overlap.begin),
reinterpret_cast<void*>(overlap.end));
if (overlap != range) {
ALOGE("range %p-%p overlaps with existing range %p-%p",
reinterpret_cast<void*>(begin),
reinterpret_cast<void*>(end),
reinterpret_cast<void*>(overlap.begin),
reinterpret_cast<void*>(overlap.end));
}
return false;
}
}

View File

@ -31,6 +31,12 @@ struct Range {
uintptr_t end;
size_t size() const { return end - begin; };
bool operator==(const Range& other) const {
return this->begin == other.begin && this->end == other.end;
}
bool operator!=(const Range& other) const {
return !(*this == other);
}
};
// Comparator for Ranges that returns equivalence for overlapping ranges