LLDB mainline
lldb_private::MemoryCache Class Reference

#include <Memory.h>

Public Member Functions

 MemoryCache (Process &process)
 ~MemoryCache ()
void Clear (bool clear_invalid_ranges=false)
void Flush (lldb::addr_t addr, size_t size)
size_t Read (lldb::addr_t addr, void *dst, size_t dst_len, Status &error)
llvm::SmallVector< llvm::MutableArrayRef< uint8_t > > ReadRanges (llvm::ArrayRef< Range< lldb::addr_t, size_t > > ranges, llvm::MutableArrayRef< uint8_t > buffer)
 Reads multiple memory ranges, serving cache hits from L1 and batching all misses through Process::DoReadMemoryRanges.
uint32_t GetMemoryCacheLineSize () const
void AddInvalidRange (lldb::addr_t base_addr, lldb::addr_t byte_size)
bool RemoveInvalidRange (lldb::addr_t base_addr, lldb::addr_t byte_size)
void AddL1CacheData (lldb::addr_t addr, const void *src, size_t src_len)
void AddL1CacheData (lldb::addr_t addr, llvm::ArrayRef< uint8_t > src)
void AddL1CacheData (lldb::addr_t addr, const lldb::DataBufferSP &data_buffer_sp)

Protected Types

typedef std::map< lldb::addr_t, lldb::DataBufferSPBlockMap
typedef RangeVector< lldb::addr_t, lldb::addr_t, 4 > InvalidRanges
typedef Range< lldb::addr_t, lldb::addr_tAddrRange

Protected Attributes

std::recursive_mutex m_mutex
BlockMap m_L1_cache
BlockMap m_L2_cache
InvalidRanges m_invalid_ranges
Processm_process
uint32_t m_L2_cache_line_byte_size

Private Member Functions

 MemoryCache (const MemoryCache &)=delete
const MemoryCacheoperator= (const MemoryCache &)=delete
lldb::DataBufferSP GetL2CacheLine (lldb::addr_t addr, Status &error)
const uint8_t * FindL1CacheEntry (lldb::addr_t addr, size_t len) const

Detailed Description

Definition at line 23 of file Memory.h.

Member Typedef Documentation

◆ AddrRange

Definition at line 63 of file Memory.h.

◆ BlockMap

Definition at line 61 of file Memory.h.

◆ InvalidRanges

Definition at line 62 of file Memory.h.

Constructor & Destructor Documentation

◆ MemoryCache() [1/2]

MemoryCache::MemoryCache ( Process & process)

◆ ~MemoryCache()

MemoryCache::~MemoryCache ( )
default

References error().

◆ MemoryCache() [2/2]

lldb_private::MemoryCache::MemoryCache ( const MemoryCache & )
privatedelete

References MemoryCache().

Member Function Documentation

◆ AddInvalidRange()

void MemoryCache::AddInvalidRange ( lldb::addr_t base_addr,
lldb::addr_t byte_size )

Definition at line 102 of file Memory.cpp.

References m_invalid_ranges, and m_mutex.

◆ AddL1CacheData() [1/3]

void MemoryCache::AddL1CacheData ( lldb::addr_t addr,
const lldb::DataBufferSP & data_buffer_sp )

Definition at line 48 of file Memory.cpp.

References m_L1_cache, and m_mutex.

◆ AddL1CacheData() [2/3]

void MemoryCache::AddL1CacheData ( lldb::addr_t addr,
const void * src,
size_t src_len )

Definition at line 43 of file Memory.cpp.

References AddL1CacheData().

Referenced by AddL1CacheData(), AddL1CacheData(), Read(), and ReadRanges().

◆ AddL1CacheData() [3/3]

void lldb_private::MemoryCache::AddL1CacheData ( lldb::addr_t addr,
llvm::ArrayRef< uint8_t > src )
inline

Definition at line 52 of file Memory.h.

References AddL1CacheData().

◆ Clear()

void MemoryCache::Clear ( bool clear_invalid_ranges = false)

◆ FindL1CacheEntry()

const uint8_t * MemoryCache::FindL1CacheEntry ( lldb::addr_t addr,
size_t len ) const
private

◆ Flush()

void MemoryCache::Flush ( lldb::addr_t addr,
size_t size )

◆ GetL2CacheLine()

lldb::DataBufferSP MemoryCache::GetL2CacheLine ( lldb::addr_t addr,
Status & error )
private

Definition at line 141 of file Memory.cpp.

References error(), m_L2_cache, m_L2_cache_line_byte_size, m_mutex, and m_process.

Referenced by Read().

◆ GetMemoryCacheLineSize()

uint32_t lldb_private::MemoryCache::GetMemoryCacheLineSize ( ) const
inline

Definition at line 43 of file Memory.h.

References m_L2_cache_line_byte_size.

Referenced by MemoryCache().

◆ operator=()

const MemoryCache & lldb_private::MemoryCache::operator= ( const MemoryCache & )
privatedelete

References error(), and MemoryCache().

◆ Read()

size_t MemoryCache::Read ( lldb::addr_t addr,
void * dst,
size_t dst_len,
Status & error )

◆ ReadRanges()

llvm::SmallVector< llvm::MutableArrayRef< uint8_t > > MemoryCache::ReadRanges ( llvm::ArrayRef< Range< lldb::addr_t, size_t > > ranges,
llvm::MutableArrayRef< uint8_t > buffer )

Reads multiple memory ranges, serving cache hits from L1 and batching all misses through Process::DoReadMemoryRanges.

The semantics of the return value match Process::ReadMemoryRanges.

Definition at line 275 of file Memory.cpp.

References AddL1CacheData(), FindL1CacheEntry(), m_invalid_ranges, m_mutex, and m_process.

◆ RemoveInvalidRange()

bool MemoryCache::RemoveInvalidRange ( lldb::addr_t base_addr,
lldb::addr_t byte_size )

Member Data Documentation

◆ m_invalid_ranges

InvalidRanges lldb_private::MemoryCache::m_invalid_ranges
protected

Definition at line 71 of file Memory.h.

Referenced by AddInvalidRange(), Clear(), MemoryCache(), Read(), ReadRanges(), and RemoveInvalidRange().

◆ m_L1_cache

BlockMap lldb_private::MemoryCache::m_L1_cache
protected

Definition at line 66 of file Memory.h.

Referenced by AddL1CacheData(), Clear(), FindL1CacheEntry(), Flush(), and MemoryCache().

◆ m_L2_cache

BlockMap lldb_private::MemoryCache::m_L2_cache
protected

Definition at line 69 of file Memory.h.

Referenced by Clear(), Flush(), GetL2CacheLine(), and MemoryCache().

◆ m_L2_cache_line_byte_size

uint32_t lldb_private::MemoryCache::m_L2_cache_line_byte_size
protected

Definition at line 73 of file Memory.h.

Referenced by Clear(), Flush(), GetL2CacheLine(), GetMemoryCacheLineSize(), MemoryCache(), and Read().

◆ m_mutex

std::recursive_mutex lldb_private::MemoryCache::m_mutex
protected

◆ m_process

Process& lldb_private::MemoryCache::m_process
protected

Definition at line 72 of file Memory.h.

Referenced by Clear(), GetL2CacheLine(), MemoryCache(), Read(), and ReadRanges().


The documentation for this class was generated from the following files: