[Lldb-commits] [lldb] r278901 - Fix the RangeMapVector::FindEntryThatContainsOrFollows method to
Jason Molenda via lldb-commits
lldb-commits at lists.llvm.org
Tue Aug 16 20:56:04 PDT 2016
Author: jmolenda
Date: Tue Aug 16 22:56:04 2016
New Revision: 278901
URL: http://llvm.org/viewvc/llvm-project?rev=278901&view=rev
Log:
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>
Modified:
lldb/trunk/include/lldb/Core/RangeMap.h
Modified: lldb/trunk/include/lldb/Core/RangeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RangeMap.h?rev=278901&r1=278900&r2=278901&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Tue Aug 16 22:56:04 2016
@@ -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);
}
More information about the lldb-commits
mailing list