================
@@ -161,21 +162,51 @@ static ProcessSP CreateProcess(lldb::TargetSP target_sp) {
   return process_sp;
 }
 
-TEST_F(MemoryTest, TesetMemoryCacheRead) {
-  ArchSpec arch("x86_64-apple-macosx-");
+// Builds the debugger, target and process a cache test needs and keeps them
+// alive.
+namespace {
+class CacheTestProcess {
+public:
+  explicit CacheTestProcess(const char *triple = "arm64-apple-macosx")
+      : m_arch(triple) {
+    Platform::SetHostPlatform(
+        PlatformRemoteMacOSX::CreateInstance(true, &m_arch));
+    m_debugger_sp = Debugger::CreateInstance();
+    if (!m_debugger_sp)
+      return;
+    m_target_sp = CreateTarget(m_debugger_sp, m_arch);
+    if (!m_target_sp)
+      return;
+    m_process_sp = CreateProcess(m_target_sp);
+    m_process = static_cast<DummyProcess *>(m_process_sp.get());
+  }
 
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, &arch));
+  DummyProcess *process() const { return m_process; }
+  // Widened from uint32_t so tests can do address arithmetic with it.
+  lldb::addr_t line() const { return m_process->GetMemoryCacheLineSize(); }
----------------
JDevlieghere wrote:

```suggestion
  lldb::addr_t GetLine() const { return m_process->GetMemoryCacheLineSize(); }
```

https://github.com/llvm/llvm-project/pull/221015
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to