[lldb] Make MemoryCache::Read more resilient
authorAlex Langford <alangford@apple.com>
Tue, 7 Mar 2023 18:12:14 +0000 (10:12 -0800)
committerAlex Langford <alangford@apple.com>
Thu, 16 Mar 2023 22:22:46 +0000 (15:22 -0700)
commitf341d7a4091a6ec1c1a4a49c4810d4a8b036ad60
tree018f0d616bdea7800ffb23e54adc13bc1948ad1f
parent91b3051ac8b5358b5b9980fd0656d6a807f41d6b
[lldb] Make MemoryCache::Read more resilient

MemoryCache::Read is not resilient to partial reads when reading memory
chunks less than or equal in size to L2 cache lines. There have been
attempts in the past to fix this but nothing really solved the root of
the issue.

I first created a test exercising MemoryCache's implementation and
documenting how I believe MemoryCache::Read should behave. I then
rewrote the implementation of MemoryCache::Read as needed to make sure
that the different scenarios behaved correctly.

rdar://105407095

Differential Revision: https://reviews.llvm.org/D145624
lldb/include/lldb/Target/Memory.h
lldb/source/Target/Memory.cpp
lldb/unittests/Target/CMakeLists.txt
lldb/unittests/Target/MemoryTest.cpp [new file with mode: 0644]