aboutsummaryrefslogtreecommitdiffstats
path: root/source/Target/Memory.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:55:28 +0000
commite81d9d49145e432d917eea3a70d2ae74dcad1d89 (patch)
tree9ed5e1a91f242e2cb5911577356e487a55c01b78 /source/Target/Memory.cpp
parent85d8ef8f1f0e0e063a8571944302be2d2026f823 (diff)
downloadsrc-e81d9d49145e432d917eea3a70d2ae74dcad1d89.tar.gz
src-e81d9d49145e432d917eea3a70d2ae74dcad1d89.zip
Vendor import of stripped lldb trunk r256633:
Notes
Notes: svn path=/vendor/lldb/dist/; revision=292932
Diffstat (limited to 'source/Target/Memory.cpp')
-rw-r--r--source/Target/Memory.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/source/Target/Memory.cpp b/source/Target/Memory.cpp
index e61b3ab91e7b..c89fd5101147 100644
--- a/source/Target/Memory.cpp
+++ b/source/Target/Memory.cpp
@@ -164,24 +164,16 @@ MemoryCache::Read (addr_t addr,
if (!m_L1_cache.empty())
{
AddrRange read_range(addr, dst_len);
- BlockMap::iterator pos = m_L1_cache.lower_bound(addr);
- if (pos != m_L1_cache.end())
+ BlockMap::iterator pos = m_L1_cache.upper_bound(addr);
+ if (pos != m_L1_cache.begin ())
{
- AddrRange chunk_range(pos->first, pos->second->GetByteSize());
- bool match = chunk_range.Contains(read_range);
- if (!match && pos != m_L1_cache.begin())
- {
- --pos;
- chunk_range.SetRangeBase(pos->first);
- chunk_range.SetByteSize(pos->second->GetByteSize());
- match = chunk_range.Contains(read_range);
- }
-
- if (match)
- {
- memcpy(dst, pos->second->GetBytes() + addr - chunk_range.GetRangeBase(), dst_len);
- return dst_len;
- }
+ --pos;
+ }
+ AddrRange chunk_range(pos->first, pos->second->GetByteSize());
+ if (chunk_range.Contains(read_range))
+ {
+ memcpy(dst, pos->second->GetBytes() + addr - chunk_range.GetRangeBase(), dst_len);
+ return dst_len;
}
}