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 memory ranges, serving hits from the cache and batching 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 AddCacheData (lldb::addr_t addr, const void *src, size_t src_len)
 Allow external sources to populate data into the memory cache.
void AddCacheData (lldb::addr_t addr, llvm::ArrayRef< uint8_t > src)
void AddCacheData (lldb::addr_t addr, const lldb::DataBufferSP &data_buffer_sp)

Protected Types

typedef RangeVector< lldb::addr_t, lldb::addr_t, 4 > InvalidRanges
typedef Range< lldb::addr_t, lldb::addr_t > AddrRange

Protected Attributes

std::recursive_mutex m_mutex
ChunkCache m_L1_cache
LineCache m_L2_cache
InvalidRanges m_invalid_ranges
Process & m_process

Private Member Functions

 MemoryCache (const MemoryCache &)=delete
const MemoryCache & operator= (const MemoryCache &)=delete
void InsertWholeLine (lldb::addr_t line_base_addr, llvm::ArrayRef< uint8_t > src)
void InsertPartialLine (lldb::addr_t addr, llvm::ArrayRef< uint8_t > src)
void InsertData (lldb::addr_t addr, llvm::ArrayRef< uint8_t > src)
size_t ReadFromCaches (lldb::addr_t addr, void *dst, size_t len) const
AddrRange GrowReadRange (lldb::addr_t read_addr, lldb::addr_t caller_end, size_t bytes_filled) const

Detailed Description

Definition at line 108 of file Memory.h.

Member Typedef Documentation

◆ AddrRange

Definition at line 148 of file Memory.h.

◆ InvalidRanges

Definition at line 147 of file Memory.h.

Constructor & Destructor Documentation

◆ MemoryCache() [1/2]

MemoryCache::MemoryCache ( Process & process)

Definition at line 116 of file Memory.cpp.

References GetMemoryCacheLineSize(), m_invalid_ranges, m_L1_cache, m_L2_cache, m_mutex, and m_process.

Referenced by MemoryCache(), and operator=().

◆ ~MemoryCache()

MemoryCache::~MemoryCache ( )
default

References error().

◆ MemoryCache() [2/2]

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

References MemoryCache().

Member Function Documentation

◆ AddCacheData() [1/3]

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

Definition at line 185 of file Memory.cpp.

References InsertData().

◆ AddCacheData() [2/3]

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

Allow external sources to populate data into the memory cache.

Definition at line 131 of file Memory.cpp.

References InsertData().

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

◆ AddCacheData() [3/3]

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

Definition at line 138 of file Memory.h.

References AddCacheData().

◆ AddInvalidRange()

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

Definition at line 200 of file Memory.cpp.

References m_invalid_ranges, and m_mutex.

◆ Clear()

void MemoryCache::Clear ( bool clear_invalid_ranges = false)

◆ Flush()

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

Definition at line 190 of file Memory.cpp.

References m_L1_cache, m_L2_cache, and m_mutex.

◆ GetMemoryCacheLineSize()

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

Definition at line 127 of file Memory.h.

References m_L2_cache.

Referenced by MemoryCache().

◆ GrowReadRange()

MemoryCache::AddrRange MemoryCache::GrowReadRange ( lldb::addr_t read_addr,
lldb::addr_t caller_end,
size_t bytes_filled ) const
private

Definition at line 250 of file Memory.cpp.

References m_invalid_ranges, m_L2_cache, and UINT64_MAX.

Referenced by Read().

◆ InsertData()

void MemoryCache::InsertData ( lldb::addr_t addr,
llvm::ArrayRef< uint8_t > src )
private

Definition at line 155 of file Memory.cpp.

References InsertPartialLine(), InsertWholeLine(), m_L2_cache, and m_mutex.

Referenced by AddCacheData(), and AddCacheData().

◆ InsertPartialLine()

void MemoryCache::InsertPartialLine ( lldb::addr_t addr,
llvm::ArrayRef< uint8_t > src )
private

Definition at line 143 of file Memory.cpp.

References m_L1_cache, and m_L2_cache.

Referenced by InsertData().

◆ InsertWholeLine()

void MemoryCache::InsertWholeLine ( lldb::addr_t line_base_addr,
llvm::ArrayRef< uint8_t > src )
private

Definition at line 136 of file Memory.cpp.

References m_L1_cache, and m_L2_cache.

Referenced by InsertData().

◆ operator=()

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

References MemoryCache().

◆ Read()

◆ ReadFromCaches()

size_t MemoryCache::ReadFromCaches ( lldb::addr_t addr,
void * dst,
size_t len ) const
private

Definition at line 225 of file Memory.cpp.

References m_L1_cache, m_L2_cache, and UINT64_MAX.

Referenced by Read(), and ReadRanges().

◆ ReadRanges()

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

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

Matches Process::ReadMemoryRanges.

Definition at line 338 of file Memory.cpp.

References AddCacheData(), m_invalid_ranges, m_mutex, m_process, and ReadFromCaches().

◆ 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

◆ m_L1_cache

ChunkCache lldb_private::MemoryCache::m_L1_cache
protected

Definition at line 153 of file Memory.h.

Referenced by Clear(), Flush(), InsertPartialLine(), InsertWholeLine(), MemoryCache(), and ReadFromCaches().

◆ m_L2_cache

LineCache lldb_private::MemoryCache::m_L2_cache
protected

◆ m_mutex

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

◆ m_process

Process& lldb_private::MemoryCache::m_process
protected

Definition at line 156 of file Memory.h.

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


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