[Lldb-commits] [lldb] [lldb][NFC] Remove unused macro ENABLE_MEMORY_CACHING (PR #142231)

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Fri May 30 15:52:01 PDT 2025


https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/142231

This macro does not do what is described. The only thing it actually does control is whether or not the process's memory cache gets flushed when writing to an address. It does not override the setting `target.process.disable-memory-cache`.

Instead of making it work as intended, I chose to remove the macro. I don't see much value in being able to override the setting with a preprocessor macro.

>From 85a979230184a7198816e0c1917217a06aee7725 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Fri, 30 May 2025 15:44:12 -0700
Subject: [PATCH] [lldb][NFC] Remove unused macro ENABLE_MEMORY_CACHING

This macro does not do what is described. The only thing it actually
does control is whether or not the process's memory cache gets flushed
when writing to an address. It does not override the setting
`target.process.disable-memory-cache`.

Instead of making it work as intended, I chose to remove the macro. I
don't see much value in being able to override the setting with a
preprocessor macro.
---
 lldb/source/Target/Process.cpp | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index c377feec86c16..84299f5f9a775 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -80,16 +80,6 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace std::chrono;
 
-// Comment out line below to disable memory caching, overriding the process
-// setting target.process.disable-memory-cache
-#define ENABLE_MEMORY_CACHING
-
-#ifdef ENABLE_MEMORY_CACHING
-#define DISABLE_MEM_CACHE_DEFAULT false
-#else
-#define DISABLE_MEM_CACHE_DEFAULT true
-#endif
-
 class ProcessOptionValueProperties
     : public Cloneable<ProcessOptionValueProperties, OptionValueProperties> {
 public:
@@ -2297,9 +2287,7 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
   if (ABISP abi_sp = GetABI())
     addr = abi_sp->FixAnyAddress(addr);
 
-#if defined(ENABLE_MEMORY_CACHING)
   m_memory_cache.Flush(addr, size);
-#endif
 
   if (buf == nullptr || size == 0)
     return 0;



More information about the lldb-commits mailing list