summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2016-08-17 03:56:04 +0000
committerJason Molenda <jmolenda@apple.com>2016-08-17 03:56:04 +0000
commit0dace2d3a1135b4e9b44a23076f9565e7186e99b (patch)
tree112069885fda5d210103d8869c16c473e494aaab
parentf7ba716bcb231dc7337637616fc2cb525d174247 (diff)
downloadbcm5719-llvm-0dace2d3a1135b4e9b44a23076f9565e7186e99b.tar.gz
bcm5719-llvm-0dace2d3a1135b4e9b44a23076f9565e7186e99b.zip
Fix the RangeMapVector::FindEntryThatContainsOrFollows method to
back up the iterator, as long as it still contains the address. std::lower_bound will point us to the entry after the one we are really interested in, leading to problems with backtracing in corefiles. <rdar://problem/27823549> llvm-svn: 278901
-rw-r--r--lldb/include/lldb/Core/RangeMap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lldb/include/lldb/Core/RangeMap.h b/lldb/include/lldb/Core/RangeMap.h
index eb68859aed3..ff9dd72f175 100644
--- a/lldb/include/lldb/Core/RangeMap.h
+++ b/lldb/include/lldb/Core/RangeMap.h
@@ -1341,6 +1341,14 @@ namespace lldb_private {
return nullptr;
}
+ // This method will return the entry that contains the given address, or the
+ // entry following that address. If you give it an address of 0 and the first
+ // entry starts at address 0x100, you will get the entry at 0x100.
+ //
+ // For most uses, FindEntryThatContains is the correct one to use, this is a
+ // less commonly needed behavior. It was added for core file memory regions,
+ // where we want to present a gap in the memory regions as a distinct region,
+ // so we need to know the start address of the next memory section that exists.
const Entry *
FindEntryThatContainsOrFollows(B addr) const
{
@@ -1349,12 +1357,16 @@ namespace lldb_private {
#endif
if (!m_entries.empty())
{
+ typename Collection::const_iterator begin = m_entries.begin();
typename Collection::const_iterator end = m_entries.end();
typename Collection::const_iterator pos =
std::lower_bound(m_entries.begin(), end, addr, [](const Entry &lhs, B rhs_base) -> bool {
return lhs.GetRangeEnd() <= rhs_base;
});
+ while (pos != begin && pos[-1].Contains(addr))
+ --pos;
+
if (pos != end)
return &(*pos);
}
OpenPOWER on IntegriCloud