[Lldb-commits] [lldb] [lldb] [unittests] Cover what the memory cache reads from the inferior (PR #221015)
Yao Qi via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 4 05:17:45 PDT 2026
================
@@ -489,6 +497,168 @@ TEST_F(MemoryTest, TestReadStopsAtAnInvalidRange) {
EXPECT_TRUE(process->m_reads.empty());
}
+TEST_F(MemoryTest, TestReadRangesFromCaches) {
+ CacheTestProcess proc;
+ ASSERT_TRUE(proc.process());
+ DummyProcess *process = proc.process();
+ const lldb::addr_t line = proc.line();
+
+ { // A short fetch must expose only the bytes it read, and must not disturb a
+ // range the caches already served.
----------------
qiyao wrote:
It destroys it, yes. `AddL1CacheData` is `m_L1_cache[addr] = data_buffer_sp`, so the 20 bytes the fetch returned replace the 40-byte chunk outright. I add a couple of asserts on L1 cache chunks.
my "must not disturb a range the caches already served" was ambiguous about `0xC000` range instead of `0xB000` range. `0xB000` was never served: 40 bytes cannot cover the 64 asked for, so `FindCacheEntry` misses and the range is fetched. I changed the comments
```
{ // An entry serves a range only if it covers it all. A short fetch is all
// the caller sees and all L1 keeps of the range it was for.
```
https://github.com/llvm/llvm-project/pull/221015
More information about the lldb-commits
mailing list