Skip to content

Commit db54719

Browse files
authored
[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.
1 parent d94846a commit db54719

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

lldb/source/Target/Process.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,6 @@ size_t Process::WriteMemoryPrivate(addr_t addr, const void *buf, size_t size,
22812281
return bytes_written;
22822282
}
22832283

2284-
#define USE_ALLOCATE_MEMORY_CACHE 1
22852284
size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
22862285
Status &error) {
22872286
if (ABISP abi_sp = GetABI())
@@ -2292,12 +2291,8 @@ size_t Process::WriteMemory(addr_t addr, const void *buf, size_t size,
22922291
if (buf == nullptr || size == 0)
22932292
return 0;
22942293

2295-
#if defined(USE_ALLOCATE_MEMORY_CACHE)
22962294
if (TrackMemoryCacheChanges() || !m_allocated_memory_cache.IsInCache(addr))
22972295
m_mod_id.BumpMemoryID();
2298-
#else
2299-
m_mod_id.BumpMemoryID();
2300-
#endif
23012296

23022297
// We need to write any data that would go where any current software traps
23032298
// (enabled software breakpoints) any software traps (breakpoints) that we
@@ -2434,20 +2429,7 @@ addr_t Process::AllocateMemory(size_t size, uint32_t permissions,
24342429
return LLDB_INVALID_ADDRESS;
24352430
}
24362431

2437-
#if defined(USE_ALLOCATE_MEMORY_CACHE)
24382432
return m_allocated_memory_cache.AllocateMemory(size, permissions, error);
2439-
#else
2440-
addr_t allocated_addr = DoAllocateMemory(size, permissions, error);
2441-
Log *log = GetLog(LLDBLog::Process);
2442-
LLDB_LOGF(log,
2443-
"Process::AllocateMemory(size=%" PRIu64
2444-
", permissions=%s) => 0x%16.16" PRIx64
2445-
" (m_stop_id = %u m_memory_id = %u)",
2446-
(uint64_t)size, GetPermissionsAsCString(permissions),
2447-
(uint64_t)allocated_addr, m_mod_id.GetStopID(),
2448-
m_mod_id.GetMemoryID());
2449-
return allocated_addr;
2450-
#endif
24512433
}
24522434

24532435
addr_t Process::CallocateMemory(size_t size, uint32_t permissions,
@@ -2500,21 +2482,10 @@ void Process::SetCanRunCode(bool can_run_code) {
25002482

25012483
Status Process::DeallocateMemory(addr_t ptr) {
25022484
Status error;
2503-
#if defined(USE_ALLOCATE_MEMORY_CACHE)
25042485
if (!m_allocated_memory_cache.DeallocateMemory(ptr)) {
25052486
error = Status::FromErrorStringWithFormat(
25062487
"deallocation of memory at 0x%" PRIx64 " failed.", (uint64_t)ptr);
25072488
}
2508-
#else
2509-
error = DoDeallocateMemory(ptr);
2510-
2511-
Log *log = GetLog(LLDBLog::Process);
2512-
LLDB_LOGF(log,
2513-
"Process::DeallocateMemory(addr=0x%16.16" PRIx64
2514-
") => err = %s (m_stop_id = %u, m_memory_id = %u)",
2515-
ptr, error.AsCString("SUCCESS"), m_mod_id.GetStopID(),
2516-
m_mod_id.GetMemoryID());
2517-
#endif
25182489
return error;
25192490
}
25202491

0 commit comments

Comments
 (0)