[Lldb-commits] [lldb] r190816 - Fixed symbol lookup to be stable when multiple symbols have the same address.
Richard Mitton
richard at codersnotes.com
Mon Sep 16 15:42:52 PDT 2013
Author: rmitton
Date: Mon Sep 16 17:42:52 2013
New Revision: 190816
URL: http://llvm.org/viewvc/llvm-project?rev=190816&view=rev
Log:
Fixed symbol lookup to be stable when multiple symbols have the same address.
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=190816&r1=190815&r2=190816&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/RangeMap.h (original)
+++ lldb/trunk/include/lldb/Core/RangeMap.h Mon Sep 16 17:42:52 2013
@@ -1229,16 +1229,11 @@ namespace lldb_private {
typename Collection::const_iterator end = m_entries.end();
typename Collection::const_iterator pos = std::lower_bound (begin, end, entry, BaseLessThan);
+ while(pos != begin && pos[-1].Contains(addr))
+ --pos;
+
if (pos != end && pos->Contains(addr))
- {
return std::distance (begin, pos);
- }
- else if (pos != begin)
- {
- --pos;
- if (pos->Contains(addr))
- return std::distance (begin, pos);
- }
}
return UINT32_MAX;
}
@@ -1257,19 +1252,12 @@ namespace lldb_private {
typename Collection::iterator begin = m_entries.begin();
typename Collection::iterator end = m_entries.end();
typename Collection::iterator pos = std::lower_bound (begin, end, entry, BaseLessThan);
+
+ while(pos != begin && pos[-1].Contains(addr))
+ --pos;
if (pos != end && pos->Contains(addr))
- {
return &(*pos);
- }
- else if (pos != begin)
- {
- --pos;
- if (pos->Contains(addr))
- {
- return &(*pos);
- }
- }
}
return NULL;
}
@@ -1288,18 +1276,11 @@ namespace lldb_private {
typename Collection::const_iterator end = m_entries.end();
typename Collection::const_iterator pos = std::lower_bound (begin, end, entry, BaseLessThan);
- if (pos != end && pos->Contains(addr))
- {
- return &(*pos);
- }
- else if (pos != begin)
- {
+ while(pos != begin && pos[-1].Contains(addr))
--pos;
- if (pos->Contains(addr))
- {
- return &(*pos);
- }
- }
+
+ if (pos != end && pos->Contains(addr))
+ return &(*pos);
}
return NULL;
}
@@ -1316,18 +1297,11 @@ namespace lldb_private {
typename Collection::const_iterator end = m_entries.end();
typename Collection::const_iterator pos = std::lower_bound (begin, end, range, BaseLessThan);
- if (pos != end && pos->Contains(range))
- {
- return &(*pos);
- }
- else if (pos != begin)
- {
+ while(pos != begin && pos[-1].Contains(range))
--pos;
- if (pos->Contains(range))
- {
- return &(*pos);
- }
- }
+
+ if (pos != end && pos->Contains(range))
+ return &(*pos);
}
return NULL;
}
@@ -1501,12 +1475,15 @@ namespace lldb_private {
typename Collection::iterator end = m_entries.end();
typename Collection::iterator pos = std::lower_bound (begin, end, entry, BaseLessThan);
+ while(pos != begin && pos[-1].addr == addr)
+ --pos;
+
if (pos != end)
{
if (pos->addr == addr || !exact_match_only)
return &(*pos);
}
- }
+ }
return NULL;
}
More information about the lldb-commits
mailing list