LLDB mainline
lldb_private::LineCache Class Reference

A set of cache entries, all of which are aligned and have the same size. More...

#include <Memory.h>

Public Types

using const_iterator = Collection::const_iterator
 Iteration yields a line index and its bytes, in unspecified order.

Public Member Functions

 LineCache (uint32_t line_byte_size)
uint32_t GetLineByteSize () const
llvm::ArrayRef< uint8_t > Lookup (lldb::addr_t addr) const
 The cached bytes from addr to the end of the line holding it, empty if that line is not resident.
bool Holds (lldb::addr_t addr) const
void Insert (lldb::addr_t addr, llvm::ArrayRef< uint8_t > src)
 Add one whole line.
void EraseRange (lldb::addr_t addr, lldb::addr_t size)
 Drop every line that intersects [addr, addr+size).
void Clear (uint32_t new_line_byte_size)
size_t GetSize () const
const_iterator begin () const
const_iterator end () const

Private Types

using Collection = llvm::DenseMap<uint64_t, std::unique_ptr<uint8_t[]>>
 Keyed by line index, so a key names a whole line.

Private Member Functions

uint64_t IndexOf (lldb::addr_t addr) const

Private Attributes

Collection m_lines
uint32_t m_line_byte_size

Detailed Description

A set of cache entries, all of which are aligned and have the same size.

Entries cannot be partially filled.

Definition at line 26 of file Memory.h.

Member Typedef Documentation

◆ Collection

using lldb_private::LineCache::Collection = llvm::DenseMap<uint64_t, std::unique_ptr<uint8_t[]>>
private

Keyed by line index, so a key names a whole line.

Definition at line 28 of file Memory.h.

◆ const_iterator

using lldb_private::LineCache::const_iterator = Collection::const_iterator

Iteration yields a line index and its bytes, in unspecified order.

Definition at line 59 of file Memory.h.

Constructor & Destructor Documentation

◆ LineCache()

lldb_private::LineCache::LineCache ( uint32_t line_byte_size)
inlineexplicit

Definition at line 31 of file Memory.h.

References m_line_byte_size.

Member Function Documentation

◆ begin()

const_iterator lldb_private::LineCache::begin ( ) const
inline

Definition at line 60 of file Memory.h.

References m_lines.

◆ Clear()

void lldb_private::LineCache::Clear ( uint32_t new_line_byte_size)
inline

Definition at line 51 of file Memory.h.

References m_line_byte_size, and m_lines.

◆ end()

const_iterator lldb_private::LineCache::end ( ) const
inline

Definition at line 61 of file Memory.h.

References m_lines.

◆ EraseRange()

void LineCache::EraseRange ( lldb::addr_t addr,
lldb::addr_t size )

Drop every line that intersects [addr, addr+size).

Definition at line 46 of file Memory.cpp.

References IndexOf(), and m_lines.

◆ GetLineByteSize()

uint32_t lldb_private::LineCache::GetLineByteSize ( ) const
inline

Definition at line 34 of file Memory.h.

References m_line_byte_size.

◆ GetSize()

size_t lldb_private::LineCache::GetSize ( ) const
inline

Definition at line 56 of file Memory.h.

References m_lines.

◆ Holds()

bool lldb_private::LineCache::Holds ( lldb::addr_t addr) const
inline

Definition at line 40 of file Memory.h.

References IndexOf(), and m_lines.

◆ IndexOf()

uint64_t lldb_private::LineCache::IndexOf ( lldb::addr_t addr) const
inlineprivate

Definition at line 64 of file Memory.h.

References m_line_byte_size.

Referenced by EraseRange(), Holds(), Insert(), and Lookup().

◆ Insert()

void LineCache::Insert ( lldb::addr_t addr,
llvm::ArrayRef< uint8_t > src )

Add one whole line.

addr must be line aligned and src must hold a whole line.

Definition at line 36 of file Memory.cpp.

References IndexOf(), m_line_byte_size, and m_lines.

◆ Lookup()

llvm::ArrayRef< uint8_t > LineCache::Lookup ( lldb::addr_t addr) const

The cached bytes from addr to the end of the line holding it, empty if that line is not resident.

Definition at line 27 of file Memory.cpp.

References IndexOf(), m_line_byte_size, and m_lines.

Member Data Documentation

◆ m_line_byte_size

uint32_t lldb_private::LineCache::m_line_byte_size
private

Definition at line 67 of file Memory.h.

Referenced by Clear(), GetLineByteSize(), IndexOf(), Insert(), LineCache(), and Lookup().

◆ m_lines

Collection lldb_private::LineCache::m_lines
private

Definition at line 66 of file Memory.h.

Referenced by begin(), Clear(), end(), EraseRange(), GetSize(), Holds(), Insert(), and Lookup().


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