[Lldb-commits] [lldb] db54719 - [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (#142689)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 4 10:43:39 PDT 2025
Author: Alex Langford
Date: 2025-06-04T10:43:36-07:00
New Revision: db5471945b7e36f55c66dfa74e218390c0329dd4
URL: https://github.com/llvm/llvm-project/commit/db5471945b7e36f55c66dfa74e218390c0329dd4
DIFF: https://github.com/llvm/llvm-project/commit/db5471945b7e36f55c66dfa74e218390c0329dd4.diff
LOG: [lldb] Remove USE_ALLOCATE_MEMORY_CACHE (#142689)
This is always on, and has been since at least 2011 from what I can
tell. The code in the `#else` clauses are effectively dead code.
Added:
Modified:
lldb/source/Target/Process.cpp
Removed:
################################################################################
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 84299f5f9a775..58edf972ddbe7 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2281,7 +2281,6 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size,
return bytes_written;
}
-#define USE_ALLOCATE_MEMORY_CACHE 1
size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
Status &error) {
if (ABISP abi_sp = GetABI())
@@ -2292,12 +2291,8 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
if (buf == nullptr || size == 0)
return 0;
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
if (TrackMemoryCacheChanges() || !m_allocated_memory_cache.IsInCache(addr))
m_mod_id.BumpMemoryID();
-#else
- m_mod_id.BumpMemoryID();
-#endif
// We need to write any data that would go where any current software traps
// (enabled software breakpoints) any software traps (breakpoints) that we
@@ -2434,20 +2429,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions,
return LLDB_INVALID_ADDRESS;
}
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
return m_allocated_memory_cache.AllocateMemory(size, permissions, error);
-#else
- addr_t allocated_addr = DoAllocateMemory(size, permissions, error);
- Log *log = GetLog(LLDBLog::Process);
- LLDB_LOGF(log,
- "Process::AllocateMemory(size=%" PRIu64
- ", permissions=%s) => 0x%16.16" PRIx64
- " (m_stop_id = %u m_memory_id = %u)",
- (uint64_t)size, GetPermissionsAsCString(permissions),
- (uint64_t)allocated_addr, m_mod_id.GetStopID(),
- m_mod_id.GetMemoryID());
- return allocated_addr;
-#endif
}
addr_t Process::CallocateMemory(size_t size, uint32_t permissions,
@@ -2500,21 +2482,10 @@ void Process::SetCanRunCode(bool can_run_code) {
Status Process::DeallocateMemory(addr_t ptr) {
Status error;
-#if defined(USE_ALLOCATE_MEMORY_CACHE)
if (!m_allocated_memory_cache.DeallocateMemory(ptr)) {
error = Status::FromErrorStringWithFormat(
"deallocation of memory at 0x%" PRIx64 " failed.", (uint64_t)ptr);
}
-#else
- error = DoDeallocateMemory(ptr);
-
- Log *log = GetLog(LLDBLog::Process);
- LLDB_LOGF(log,
- "Process::DeallocateMemory(addr=0x%16.16" PRIx64
- ") => err = %s (m_stop_id = %u, m_memory_id = %u)",
- ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
- m_mod_id.GetMemoryID());
-#endif
return error;
}
More information about the lldb-commits
mailing list