diff options
Diffstat (limited to 'lldb/source/Target/Memory.cpp')
-rw-r--r-- | lldb/source/Target/Memory.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lldb/source/Target/Memory.cpp b/lldb/source/Target/Memory.cpp index 7c77cc06eb03..a7ed1a3d97b7 100644 --- a/lldb/source/Target/Memory.cpp +++ b/lldb/source/Target/Memory.cpp @@ -1,4 +1,4 @@ -//===-- Memory.cpp ----------------------------------------------*- C++ -*-===// +//===-- Memory.cpp --------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -116,7 +116,7 @@ bool MemoryCache::RemoveInvalidRange(lldb::addr_t base_addr, const InvalidRanges::Entry *entry = m_invalid_ranges.GetEntryAtIndex(idx); if (entry->GetRangeBase() == base_addr && entry->GetByteSize() == byte_size) - return m_invalid_ranges.RemoveEntrtAtIndex(idx); + return m_invalid_ranges.RemoveEntryAtIndex(idx); } } return false; @@ -232,8 +232,13 @@ size_t MemoryCache::Read(addr_t addr, void *dst, size_t dst_len, if (process_bytes_read == 0) return dst_len - bytes_left; - if (process_bytes_read != cache_line_byte_size) + if (process_bytes_read != cache_line_byte_size) { + if (process_bytes_read < data_buffer_heap_up->GetByteSize()) { + dst_len -= data_buffer_heap_up->GetByteSize() - process_bytes_read; + bytes_left = process_bytes_read; + } data_buffer_heap_up->SetByteSize(process_bytes_read); + } m_L2_cache[curr_addr] = DataBufferSP(data_buffer_heap_up.release()); // We have read data and put it into the cache, continue through the // loop again to get the data out of the cache... |