LLDB mainline
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Attributes | List of all members
lldb_private::DataBufferHeap Class Reference

A subclass of DataBuffer that stores a data buffer on the heap. More...

#include "lldb/Core/DataBufferHeap.h"

Inheritance diagram for lldb_private::DataBufferHeap:
Inheritance graph
[legend]

Public Member Functions

 DataBufferHeap ()
 Default constructor.
 
 DataBufferHeap (lldb::offset_t n, uint8_t ch)
 Construct with size n and fill with ch.
 
 DataBufferHeap (const void *src, lldb::offset_t src_len)
 Construct by making a copy of src_len bytes from src.
 
 DataBufferHeap (const DataBuffer &data_buffer)
 Construct by making a copy of a DataBuffer.
 
 ~DataBufferHeap () override
 Destructor.
 
const uint8_t * GetBytesImpl () const override
 Get a const pointer to the data.
 
lldb::offset_t GetByteSize () const override
 Get the number of bytes in the data buffer.
 
lldb::offset_t SetByteSize (lldb::offset_t byte_size)
 Set the number of bytes in the data buffer.
 
void CopyData (const void *src, lldb::offset_t src_len)
 Makes a copy of the src_len bytes in src.
 
void CopyData (llvm::StringRef src)
 
void AppendData (const void *src, uint64_t src_len)
 
void Clear ()
 
bool isA (const void *ClassID) const override
 
- Public Member Functions inherited from lldb_private::WritableDataBuffer
 ~WritableDataBuffer () override=default
 Destructor.
 
uint8_t * GetBytes ()
 Get a pointer to the data.
 
llvm::MutableArrayRef< uint8_t > GetData ()
 
bool isA (const void *ClassID) const override
 
const uint8_t * GetBytes () const
 Get a const pointer to the data.
 
llvm::ArrayRef< uint8_t > GetData () const
 
- Public Member Functions inherited from lldb_private::DataBuffer
virtual ~DataBuffer ()=default
 
virtual lldb::offset_t GetByteSize () const =0
 Get the number of bytes in the data buffer.
 
const uint8_t * GetBytes () const
 Get a const pointer to the data.
 
llvm::ArrayRef< uint8_t > GetData () const
 
virtual bool isA (const void *ClassID) const
 

Static Public Member Functions

static bool classof (const DataBuffer *data_buffer)
 
- Static Public Member Functions inherited from lldb_private::WritableDataBuffer
static bool classof (const DataBuffer *data_buffer)
 
- Static Public Member Functions inherited from lldb_private::DataBuffer
static bool classof (const DataBuffer *data_buffer)
 

Static Public Attributes

static char ID
 LLVM RTTI support.
 
- Static Public Attributes inherited from lldb_private::WritableDataBuffer
static char ID
 LLVM RTTI support.
 
- Static Public Attributes inherited from lldb_private::DataBuffer
static char ID
 LLVM RTTI support.
 

Private Types

typedef std::vector< uint8_t > buffer_t
 }
 

Private Attributes

buffer_t m_data
 The heap based buffer where data is stored.
 

Additional Inherited Members

virtual const uint8_t * GetBytesImpl () const =0
 }
 

Detailed Description

A subclass of DataBuffer that stores a data buffer on the heap.

This class keeps its data in a heap based buffer that is owned by the object. This class is best used to store chunks of data that are created or read from sources that can't intelligently and lazily fault new data pages in. Large amounts of data that comes from files should probably use DataBufferLLVM, which can intelligently determine when memory mapping is optimal.

Definition at line 30 of file DataBufferHeap.h.

Member Typedef Documentation

◆ buffer_t

typedef std::vector<uint8_t> lldb_private::DataBufferHeap::buffer_t
private

}

Buffer type

Definition at line 120 of file DataBufferHeap.h.

Constructor & Destructor Documentation

◆ DataBufferHeap() [1/4]

DataBufferHeap::DataBufferHeap ( )

Default constructor.

Initializes the heap based buffer with no bytes.

Definition at line 15 of file DataBufferHeap.cpp.

◆ DataBufferHeap() [2/4]

DataBufferHeap::DataBufferHeap ( lldb::offset_t  n,
uint8_t  ch 
)

Construct with size n and fill with ch.

Initialize this class with n bytes and fills the buffer with ch.

Parameters
[in]nThe number of bytes that heap based buffer should contain.
[in]chThe character to use when filling the buffer initially.

Definition at line 18 of file DataBufferHeap.cpp.

References m_data.

◆ DataBufferHeap() [3/4]

DataBufferHeap::DataBufferHeap ( const void *  src,
lldb::offset_t  src_len 
)

Construct by making a copy of src_len bytes from src.

Parameters
[in]srcA pointer to the data to copy.
[in]src_lenThe number of bytes in src to copy.

Definition at line 24 of file DataBufferHeap.cpp.

References CopyData().

◆ DataBufferHeap() [4/4]

DataBufferHeap::DataBufferHeap ( const DataBuffer data_buffer)

Construct by making a copy of a DataBuffer.

Parameters
[in]data_bufferA read only data buffer to copy.

Definition at line 29 of file DataBufferHeap.cpp.

References CopyData(), lldb_private::DataBuffer::GetBytes(), and lldb_private::DataBuffer::GetByteSize().

◆ ~DataBufferHeap()

DataBufferHeap::~DataBufferHeap ( )
overridedefault

Destructor.

Virtual destructor since this class inherits from a pure virtual base class #DataBuffer.

Member Function Documentation

◆ AppendData()

void DataBufferHeap::AppendData ( const void *  src,
uint64_t  src_len 
)

◆ classof()

static bool lldb_private::DataBufferHeap::classof ( const DataBuffer data_buffer)
inlinestatic

Definition at line 112 of file DataBufferHeap.h.

References ID, and lldb_private::DataBuffer::isA().

◆ Clear()

void DataBufferHeap::Clear ( )

Definition at line 66 of file DataBufferHeap.cpp.

References m_data.

Referenced by lldb_private::Value::Clear().

◆ CopyData() [1/2]

void DataBufferHeap::CopyData ( const void *  src,
lldb::offset_t  src_len 
)

Makes a copy of the src_len bytes in src.

Copies the data in src into an internal buffer.

Parameters
[in]srcA pointer to the data to copy.
[in]src_lenThe number of bytes in src to copy.

Definition at line 53 of file DataBufferHeap.cpp.

References m_data.

Referenced by DataBufferHeap(), CommandObjectMemoryFind::DoExecute(), lldb_private::ValueObject::GetPointeeData(), lldb_private::Value::operator=(), lldb_private::Value::SetBytes(), and lldb_private::Value::Value().

◆ CopyData() [2/2]

void lldb_private::DataBufferHeap::CopyData ( llvm::StringRef  src)
inline

Definition at line 100 of file DataBufferHeap.h.

References CopyData().

Referenced by CopyData().

◆ GetBytesImpl()

const uint8_t * DataBufferHeap::GetBytesImpl ( ) const
overridevirtual

Get a const pointer to the data.

Returns
A const pointer to the bytes owned by this object, or NULL if the object contains no bytes.

Implements lldb_private::DataBuffer.

Definition at line 38 of file DataBufferHeap.cpp.

References m_data.

◆ GetByteSize()

uint64_t DataBufferHeap::GetByteSize ( ) const
overridevirtual

Get the number of bytes in the data buffer.

Returns
The number of bytes this object currently contains.

Implements lldb_private::DataBuffer.

Definition at line 43 of file DataBufferHeap.cpp.

References m_data.

Referenced by MinidumpFileBuilder::AddModuleList(), MinidumpFileBuilder::AddThreadList(), lldb_private::Value::AppendDataToHostBuffer(), InterpreterStackFrame::AssignValue(), SystemRuntimeMacOSX::CompleteQueueItem(), CommandObjectMemoryFind::DoExecute(), MinidumpFileBuilder::Dump(), EntityPersistentVariable::DumpToLog(), EntityVariableBase::DumpToLog(), EntityResultVariable::DumpToLog(), EntitySymbol::DumpToLog(), EntityRegister::DumpToLog(), lldb_private::DWARFExpression::Evaluate(), lldb_private::AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(), lldb_private::formatters::NSSetISyntheticFrontEnd::GetChildAtIndex(), lldb_private::formatters::GenericNSSetMSyntheticFrontEnd< D32, D64 >::GetChildAtIndex(), MinidumpFileBuilder::GetCurrentDataEndOffset(), lldb_private::Value::GetData(), SystemRuntimeMacOSX::GetExtendedBacktraceFromItemRef(), SystemRuntimeMacOSX::GetExtendedBacktraceThread(), GetMacOSXProcessArgs(), lldb_private::IRMemoryMap::GetMemoryData(), SystemRuntimeMacOSX::GetPendingItemRefsForQueue(), GetReturnValuePassedInMemory(), lldb_private::IRExecutionUnit::GetRunnableInfo(), IRInterpreter::Interpret(), lldb_private::Value::operator=(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), lldb_private::ClassDescriptorV2::class_ro_t::Read(), DynamicLoaderMacOSXDYLD::ReadImageInfos(), lldb::SBTarget::ReadInstructions(), ReadJITEntry(), DynamicLoaderDarwinKernel::ReadKextSummaries(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::IRMemoryMap::ReadMemory(), lldb_private::IRMemoryMap::ReadScalarFromMemory(), lldb_private::Value::ResizeData(), InterpreterStackFrame::ResolveConstant(), lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV2::DynamicClassInfoExtractor::UpdateISAToDescriptorMap(), lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded(), lldb_private::ValueObjectVariable::UpdateValue(), lldb_private::Value::Value(), lldb_private::IRMemoryMap::WriteMemory(), and lldb_private::IRExecutionUnit::WriteNow().

◆ isA()

bool lldb_private::DataBufferHeap::isA ( const void *  ClassID) const
inlineoverridevirtual

Reimplemented from lldb_private::WritableDataBuffer.

Definition at line 109 of file DataBufferHeap.h.

References ID, and lldb_private::WritableDataBuffer::isA().

◆ SetByteSize()

uint64_t DataBufferHeap::SetByteSize ( lldb::offset_t  byte_size)

Set the number of bytes in the data buffer.

Sets the number of bytes that this object should be able to contain. This can be used prior to copying data into the buffer. Note that this zero-initializes up to byte_size bytes.

Parameters
[in]byte_sizeThe new size in bytes that this data buffer should attempt to resize itself to.
Returns
The size in bytes after this heap buffer was resized. If the resize failed the size will remain unchanged.

Definition at line 47 of file DataBufferHeap.cpp.

References m_data.

Referenced by lldb_private::IRMemoryMap::Allocation::Allocation(), lldb_private::ValueObject::GetPointeeData(), lldb_private::Value::ResizeData(), and lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded().

Member Data Documentation

◆ ID

char DataBufferHeap::ID
static

LLVM RTTI support.

{

Definition at line 108 of file DataBufferHeap.h.

Referenced by classof(), and isA().

◆ m_data

buffer_t lldb_private::DataBufferHeap::m_data
private

The heap based buffer where data is stored.

Definition at line 121 of file DataBufferHeap.h.

Referenced by AppendData(), Clear(), CopyData(), DataBufferHeap(), GetBytesImpl(), GetByteSize(), and SetByteSize().


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