LLDB mainline
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lldb_private::DataExtractor Class Reference

An data extractor class. More...

#include "lldb/Core/DataExtractor.h"

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

Public Types

enum  Type {
  TypeUInt8 , TypeChar , TypeUInt16 , TypeUInt32 ,
  TypeUInt64 , TypePointer , TypeULEB128 , TypeSLEB128
}
 Type enumerations used in the dump routines. More...
 

Public Member Functions

 DataExtractor ()
 Default constructor.
 
 DataExtractor (const void *data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size=1)
 Construct with a buffer that is owned by the caller.
 
 DataExtractor (const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size=1)
 Construct with shared data.
 
 DataExtractor (const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size=1)
 Construct with a subset of data.
 
 DataExtractor (const DataExtractor &rhs)
 Copy constructor.
 
const DataExtractoroperator= (const DataExtractor &rhs)
 Assignment operator.
 
 DataExtractor (DataExtractor &&rhs)=default
 Move constructor and move assignment operators to complete the rule of 5.
 
DataExtractoroperator= (DataExtractor &&rhs)=default
 
virtual ~DataExtractor ()
 Destructor.
 
uint32_t getTargetByteSize () const
 
void Clear ()
 Clears the object state.
 
lldb::offset_t PutToLog (Log *log, lldb::offset_t offset, lldb::offset_t length, uint64_t base_addr, uint32_t num_per_line, Type type) const
 Dumps the binary data as type objects to stream s (or to Log() if s is nullptr) starting offset bytes into the data and stopping after dumping length bytes.
 
size_t ExtractBytes (lldb::offset_t offset, lldb::offset_t length, lldb::ByteOrder dst_byte_order, void *dst) const
 Extract an arbitrary number of bytes in the specified byte order.
 
uint64_t GetAddress (lldb::offset_t *offset_ptr) const
 Extract an address from *offset_ptr.
 
uint64_t GetAddress_unchecked (lldb::offset_t *offset_ptr) const
 
uint32_t GetAddressByteSize () const
 Get the current address size.
 
uint64_t GetByteSize () const
 Get the number of bytes contained in this object.
 
const char * GetCStr (lldb::offset_t *offset_ptr) const
 Extract a C string from *offset_ptr.
 
const char * GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const
 Extract a C string from *offset_ptr with field size len.
 
const void * GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const
 Extract length bytes from *offset_ptr.
 
lldb::offset_t CopyData (lldb::offset_t offset, lldb::offset_t length, void *dst) const
 Copy length bytes from *offset, without swapping bytes.
 
lldb::offset_t CopyByteOrderedData (lldb::offset_t src_offset, lldb::offset_t src_len, void *dst, lldb::offset_t dst_len, lldb::ByteOrder dst_byte_order) const
 Copy dst_len bytes from *offset_ptr and ensure the copied data is treated as a value that can be swapped to match the specified byte order.
 
const uint8_t * GetDataEnd () const
 Get the data end pointer.
 
size_t GetSharedDataOffset () const
 Get the shared data offset.
 
const uint8_t * GetDataStart () const
 Get the data start pointer.
 
float GetFloat (lldb::offset_t *offset_ptr) const
 Extract a float from *offset_ptr.
 
double GetDouble (lldb::offset_t *offset_ptr) const
 
long double GetLongDouble (lldb::offset_t *offset_ptr) const
 
uint32_t GetMaxU32 (lldb::offset_t *offset_ptr, size_t byte_size) const
 Extract an integer of size byte_size from *offset_ptr.
 
uint64_t GetMaxU64 (lldb::offset_t *offset_ptr, size_t byte_size) const
 Extract an unsigned integer of size byte_size from *offset_ptr.
 
uint64_t GetMaxU64_unchecked (lldb::offset_t *offset_ptr, size_t byte_size) const
 
int64_t GetMaxS64 (lldb::offset_t *offset_ptr, size_t byte_size) const
 Extract an signed integer of size byte_size from *offset_ptr.
 
uint64_t GetMaxU64Bitfield (lldb::offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const
 Extract an unsigned integer of size byte_size from *offset_ptr, then extract the bitfield from this value if bitfield_bit_size is non-zero.
 
int64_t GetMaxS64Bitfield (lldb::offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const
 Extract an signed integer of size size from *offset_ptr, then extract and sign-extend the bitfield from this value if bitfield_bit_size is non-zero.
 
lldb::ByteOrder GetByteOrder () const
 Get the current byte order value.
 
uint8_t GetU8 (lldb::offset_t *offset_ptr) const
 Extract a uint8_t value from *offset_ptr.
 
uint8_t GetU8_unchecked (lldb::offset_t *offset_ptr) const
 
uint16_t GetU16_unchecked (lldb::offset_t *offset_ptr) const
 
uint32_t GetU32_unchecked (lldb::offset_t *offset_ptr) const
 
uint64_t GetU64_unchecked (lldb::offset_t *offset_ptr) const
 
void * GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint8_t values from *offset_ptr.
 
uint16_t GetU16 (lldb::offset_t *offset_ptr) const
 Extract a uint16_t value from *offset_ptr.
 
void * GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint16_t values from *offset_ptr.
 
uint32_t GetU32 (lldb::offset_t *offset_ptr) const
 Extract a uint32_t value from *offset_ptr.
 
void * GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint32_t values from *offset_ptr.
 
uint64_t GetU64 (lldb::offset_t *offset_ptr) const
 Extract a uint64_t value from *offset_ptr.
 
void * GetU64 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint64_t values from *offset_ptr.
 
int64_t GetSLEB128 (lldb::offset_t *offset_ptr) const
 Extract a signed LEB128 value from *offset_ptr.
 
uint64_t GetULEB128 (lldb::offset_t *offset_ptr) const
 Extract a unsigned LEB128 value from *offset_ptr.
 
lldb::DataBufferSPGetSharedDataBuffer ()
 
const char * PeekCStr (lldb::offset_t offset) const
 Peek at a C string at offset.
 
const uint8_t * PeekData (lldb::offset_t offset, lldb::offset_t length) const
 Peek at a bytes at offset.
 
void SetAddressByteSize (uint32_t addr_size)
 Set the address byte size.
 
lldb::offset_t SetData (const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
 Set data with a buffer that is caller owned.
 
lldb::offset_t SetData (const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length)
 Adopt a subset of data.
 
lldb::offset_t SetData (const lldb::DataBufferSP &data_sp, lldb::offset_t offset=0, lldb::offset_t length=LLDB_INVALID_OFFSET)
 Adopt a subset of shared data in data_sp.
 
void SetByteOrder (lldb::ByteOrder byte_order)
 Set the byte_order value.
 
uint32_t Skip_LEB128 (lldb::offset_t *offset_ptr) const
 Skip an LEB128 number at *offset_ptr.
 
bool ValidOffset (lldb::offset_t offset) const
 Test the validity of offset.
 
bool ValidOffsetForDataOfSize (lldb::offset_t offset, lldb::offset_t length) const
 Test the availability of length bytes of data from offset.
 
size_t Copy (DataExtractor &dest_data) const
 
bool Append (DataExtractor &rhs)
 
bool Append (void *bytes, lldb::offset_t length)
 
lldb::offset_t BytesLeft (lldb::offset_t offset) const
 
void Checksum (llvm::SmallVectorImpl< uint8_t > &dest, uint64_t max_data=0)
 
llvm::ArrayRef< uint8_t > GetData () const
 
llvm::DataExtractor GetAsLLVM () const
 

Protected Member Functions

template<typename T >
Get (lldb::offset_t *offset_ptr, T fail_value) const
 

Protected Attributes

const uint8_t * m_start = nullptr
 A pointer to the first byte of data.
 
const uint8_t * m_end
 A pointer to the byte that is past the end of the data.
 
lldb::ByteOrder m_byte_order
 The byte order of the data we are extracting from.
 
uint32_t m_addr_size
 The address size to use when extracting addresses.
 
lldb::DataBufferSP m_data_sp
 The shared pointer to data that can be shared among multiple instances.
 
uint32_t m_target_byte_size = 1
 Making it const would require implementation of move assignment operator.
 

Detailed Description

An data extractor class.

DataExtractor is a class that can extract data (swapping if needed) from a data buffer. The data buffer can be caller owned, or can be shared data that can be shared between multiple DataExtractor instances. Multiple DataExtractor objects can share the same data, yet extract values in different address sizes and byte order modes. Each object can have a unique position in the shared data and extract data from different offsets.

See also
DataBuffer

Definition at line 48 of file DataExtractor.h.

Member Enumeration Documentation

◆ Type

Type enumerations used in the dump routines.

Enumerator
TypeUInt8 

Format output as unsigned 8 bit integers.

TypeChar 

Format output as characters.

TypeUInt16 

Format output as unsigned 16 bit integers.

TypeUInt32 

Format output as unsigned 32 bit integers.

TypeUInt64 

Format output as unsigned 64 bit integers.

TypePointer 

Format output as pointers.

TypeULEB128 

Format output as ULEB128 numbers.

TypeSLEB128 

Format output as SLEB128 numbers.

Definition at line 52 of file DataExtractor.h.

Constructor & Destructor Documentation

◆ DataExtractor() [1/6]

DataExtractor::DataExtractor ( )

Default constructor.

Initialize all members to a default empty state.

Definition at line 123 of file DataExtractor.cpp.

◆ DataExtractor() [2/6]

DataExtractor::DataExtractor ( const void *  data,
lldb::offset_t  data_length,
lldb::ByteOrder  byte_order,
uint32_t  addr_size,
uint32_t  target_byte_size = 1 
)

Construct with a buffer that is owned by the caller.

This constructor allows us to use data that is owned by the caller. The data must stay around as long as this object is valid.

Parameters
[in]dataA pointer to caller owned data.
[in]data_lengthThe length in bytes of data.
[in]byte_orderA byte order of the data that we are extracting from.
[in]addr_sizeA new address byte size value.
[in]target_byte_sizeA size of a target byte in 8-bit host bytes

Definition at line 129 of file DataExtractor.cpp.

◆ DataExtractor() [3/6]

DataExtractor::DataExtractor ( const lldb::DataBufferSP data_sp,
lldb::ByteOrder  byte_order,
uint32_t  addr_size,
uint32_t  target_byte_size = 1 
)

Construct with shared data.

Copies the data shared pointer which adds a reference to the contained in data_sp. The shared data reference is reference counted to ensure the data lives as long as anyone still has a valid shared pointer to the data in data_sp.

Parameters
[in]data_spA shared pointer to data.
[in]byte_orderA byte order of the data that we are extracting from.
[in]addr_sizeA new address byte size value.
[in]target_byte_sizeA size of a target byte in 8-bit host bytes

Definition at line 143 of file DataExtractor.cpp.

References SetData().

◆ DataExtractor() [4/6]

DataExtractor::DataExtractor ( const DataExtractor data,
lldb::offset_t  offset,
lldb::offset_t  length,
uint32_t  target_byte_size = 1 
)

Construct with a subset of data.

Initialize this object with a subset of the data bytes in data. If data contains shared data, then a reference to the shared data will be added to ensure the shared data stays around as long as any objects have references to the shared data. The byte order value and the address size settings are copied from data. If offset is not a valid offset in data, then no reference to the shared data will be added. If there are not length bytes available in data starting at offset, the length will be truncated to contain as many bytes as possible.

Parameters
[in]dataAnother DataExtractor object that contains data.
[in]offsetThe offset into data at which the subset starts.
[in]lengthThe length in bytes of the subset of data.
[in]target_byte_sizeA size of a target byte in 8-bit host bytes

Definition at line 157 of file DataExtractor.cpp.

References GetByteSize(), m_addr_size, SetData(), and ValidOffset().

◆ DataExtractor() [5/6]

DataExtractor::DataExtractor ( const DataExtractor rhs)
explicit

Copy constructor.

The copy constructor is explicit as otherwise it is easy to make unintended modification of a local copy instead of a caller's instance. Also a needless copy of the m_data_sp shared pointer is/ expensive.

Definition at line 170 of file DataExtractor.cpp.

References m_addr_size.

◆ DataExtractor() [6/6]

lldb_private::DataExtractor::DataExtractor ( DataExtractor &&  rhs)
default

Move constructor and move assignment operators to complete the rule of 5.

They would get deleted as we already defined those of rule of 3.

◆ ~DataExtractor()

DataExtractor::~DataExtractor ( )
virtualdefault

Destructor.

If this object contains a valid shared data reference, the reference count on the data will be decremented, and if zero, the data will be freed.

Member Function Documentation

◆ Append() [1/2]

bool DataExtractor::Append ( DataExtractor rhs)

◆ Append() [2/2]

bool DataExtractor::Append ( void *  bytes,
lldb::offset_t  length 
)

◆ BytesLeft()

lldb::offset_t lldb_private::DataExtractor::BytesLeft ( lldb::offset_t  offset) const
inline

◆ Checksum()

void DataExtractor::Checksum ( llvm::SmallVectorImpl< uint8_t > &  dest,
uint64_t  max_data = 0 
)

Definition at line 1030 of file DataExtractor.cpp.

References GetByteSize(), and GetDataStart().

Referenced by lldb_private::ValueObject::UpdateValueIfNeeded().

◆ Clear()

void DataExtractor::Clear ( )

◆ Copy()

size_t DataExtractor::Copy ( DataExtractor dest_data) const

Definition at line 963 of file DataExtractor.cpp.

References GetByteSize(), m_data_sp, m_start, and SetData().

Referenced by Append().

◆ CopyByteOrderedData()

lldb::offset_t DataExtractor::CopyByteOrderedData ( lldb::offset_t  src_offset,
lldb::offset_t  src_len,
void *  dst,
lldb::offset_t  dst_len,
lldb::ByteOrder  dst_byte_order 
) const

Copy dst_len bytes from *offset_ptr and ensure the copied data is treated as a value that can be swapped to match the specified byte order.

For values that are larger than the supported integer sizes, this function can be used to extract data in a specified byte order. It can also be used to copy a smaller integer value from to a larger value. The extra bytes left over will be padded correctly according to the byte order of this object and the dst_byte_order. This can be very handy when say copying a partial data value into a register.

Parameters
[in]src_offsetThe offset into this data from which to start copying an endian entity
[in]src_lenThe length of the endian data to copy from this object into the dst object
[out]dstThe buffer where to place the endian data. The data might need to be byte swapped (and appropriately padded with zeroes if src_len != dst_len) if dst_byte_order does not match the byte order in this object.
[in]dst_lenThe length number of bytes that the endian value will occupy is dst.
[in]dst_byte_orderThe byte order that the endian value should be in the dst buffer.
Returns
Returns the number of bytes that were copied, or zero if anything goes wrong.

Definition at line 691 of file DataExtractor.cpp.

References lldb::eByteOrderBig, lldb::eByteOrderLittle, m_byte_order, PeekData(), and ValidOffsetForDataOfSize().

Referenced by lldb_private::RegisterValue::GetAsMemoryData(), lldb_private::Scalar::GetAsMemoryData(), GetLongDouble(), ABISysV_mips::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_ppc::GetReturnValueObjectImpl(), ABISysV_x86_64::GetReturnValueObjectImpl(), ABIWindows_x86_64::GetReturnValueObjectImpl(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), lldb_private::ValueObject::SetData(), ABISysV_ppc::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABIWindows_x86_64::SetReturnValueObject(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::RegisterValue::SetValueFromData(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().

◆ CopyData()

lldb::offset_t DataExtractor::CopyData ( lldb::offset_t  offset,
lldb::offset_t  length,
void *  dst 
) const

Copy length bytes from *offset, without swapping bytes.

Parameters
[in]offsetThe offset into this data from which to start copying
[in]lengthThe length of the data to copy from this object
[out]dstThe buffer to place the output data.
Returns
Returns the number of bytes that were copied, or zero if anything goes wrong.

Definition at line 679 of file DataExtractor.cpp.

References PeekData().

Referenced by lldb_private::ObjectFile::CopyData(), ObjectFileMachO::FindLC_NOTEByName(), ObjectFileMachO::GetCorefileAllImageInfos(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetCorefileThreadExtraInfos(), ObjectFileMachO::GetIdentifierString(), ParseFileset(), RegisterContextCorePOSIX_powerpc::ReadRegister(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegister(), and ObjectFileELF::ReadSectionData().

◆ ExtractBytes()

size_t DataExtractor::ExtractBytes ( lldb::offset_t  offset,
lldb::offset_t  length,
lldb::ByteOrder  dst_byte_order,
void *  dst 
) const

Extract an arbitrary number of bytes in the specified byte order.

Attemps to extract length bytes starting at offset bytes into this data in the requested byte order (dst_byte_order) and place the results in dst. dst must be at least length bytes long.

Parameters
[in]offsetThe offset in bytes into the contained data at which to start extracting.
[in]lengthThe number of bytes to extract.
[in]dst_byte_orderA byte order of the data that we want when the value in copied to dst.
[out]dstThe buffer that will receive the extracted value if there are enough bytes available in the current data.
Returns
The number of bytes that were extracted which will be length when the value is successfully extracted, or zero if there aren't enough bytes at the specified offset.

Definition at line 660 of file DataExtractor.cpp.

References GetByteOrder(), and PeekData().

Referenced by ObjectFileMachO::GetAllArchSpecs(), ELFLinuxPrPsInfo::Parse(), ELFNote::Parse(), RegisterContextCorePOSIX_x86_64::RegisterContextCorePOSIX_x86_64(), RegisterContextDarwin_arm_Mach::SetRegisterDataFrom_LC_THREAD(), and RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD().

◆ Get()

template<typename T >
T lldb_private::DataExtractor::Get ( lldb::offset_t offset_ptr,
fail_value 
) const
inlineprotected

◆ GetAddress()

uint64_t DataExtractor::GetAddress ( lldb::offset_t offset_ptr) const

Extract an address from *offset_ptr.

Extract a single address from the data and update the offset pointed to by offset_ptr. The size of the extracted address comes from the m_addr_size member variable and should be set correctly prior to extracting any address values.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted address value.

Definition at line 650 of file DataExtractor.cpp.

References GetMaxU64(), and m_addr_size.

Referenced by DerefSizeExtractDataHelper(), CommunicationKDP::DumpPacket(), EntityVariableBase::DumpToLog(), EntityResultVariable::DumpToLog(), lldb_private::DWARFExpression::Evaluate(), lldb_private::AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(), SystemRuntimeMacOSX::ExtractItemInfoFromBuffer(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), lldb_private::AppleObjCRuntime::GetBacktraceThreadFromException(), GetGNUEHPointer(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), SystemRuntimeMacOSX::GetPendingItemRefsForQueue(), lldb_private::ValueObject::GetPointerValue(), lldb_private::DynamicLoaderDarwin::GetThreadLocalData(), GetVTableAddress(), EntityVariableBase::Materialize(), ELFLinuxPrStatus::Parse(), ELFLinuxPrPsInfo::Parse(), AuxVector::ParseAuxv(), lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), ObjectFileMachO::ProcessSegmentCommand(), PutToLog(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DynamicLoaderMacOSXDYLD::ReadImageInfos(), ReadJITEntry(), ObjectFileELF::RefineModuleDetailsFromNote(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(), lldb_private::ValueObjectDynamicValue::SetData(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion(), and lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded().

◆ GetAddress_unchecked()

uint64_t DataExtractor::GetAddress_unchecked ( lldb::offset_t offset_ptr) const

◆ GetAddressByteSize()

uint32_t lldb_private::DataExtractor::GetAddressByteSize ( ) const
inline

Get the current address size.

Return the size in bytes of any address values this object will extract.

Returns
The size in bytes of address values that will be extracted.

Definition at line 264 of file DataExtractor.h.

References m_addr_size.

Referenced by lldb_private::ValueObject::AddressOf(), lldb_private::ValueObject::CreateConstantValue(), lldb_private::DWARFExpression::DumpLocation(), lldb_private::DWARFExpressionList::DumpLocations(), lldb_private::DWARFExpression::Evaluate(), lldb_private::ObjectFileJIT::GetAddressByteSize(), ObjectFileELF::GetAddressByteSize(), ObjectFileMachO::GetAddressByteSize(), GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), lldb_private::ValueObject::GetData(), lldb_private::DWARFExpressionList::GetDescription(), GetGNUEHPointer(), lldb_private::ValueObject::GetLocationAsCStringImpl(), lldb_private::plugin::dwarf::DWARFUnit::GetLocationTable(), GetOpcodeDataSize(), GetVTableAddress(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), ELFLinuxPrPsInfo::Parse(), elf::ELFSectionHeader::Parse(), elf::ELFProgramHeader::Parse(), elf::ELFSymbol::Parse(), elf::ELFDynamic::Parse(), elf::ELFRel::Parse(), elf::ELFRela::Parse(), AuxVector::ParseAuxv(), lldb_private::DWARFExpression::ParseDWARFLocationList(), lldb_private::SymbolFileCTF::ParseHeader(), ObjectFileMachO::ParseSymtab(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), ObjectFileELF::RefineModuleDetailsFromNote(), lldb_private::DWARFExpression::Update_DW_OP_addr(), lldb_private::ValueObject::ValueObject(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues().

◆ GetAsLLVM()

llvm::DataExtractor lldb_private::DataExtractor::GetAsLLVM ( ) const
inline

◆ GetByteOrder()

lldb::ByteOrder lldb_private::DataExtractor::GetByteOrder ( ) const
inline

Get the current byte order value.

Returns
The current byte order value from this object's internal state.

Definition at line 594 of file DataExtractor.h.

References m_byte_order.

Referenced by Append(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::ValueObject::CreateConstantValue(), InstructionLLVMC::Decode(), EntityRegister::Dematerialize(), lldb_private::DumpDataExtractor(), ExtractBytes(), ObjectFileMachO::GetAllArchSpecs(), GetAPInt(), GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), lldb_private::ObjectFileJIT::GetByteOrder(), ObjectFileMachO::GetByteOrder(), lldb_private::Value::GetData(), lldb_private::ValueObject::GetData(), lldb_private::plugin::dwarf::DWARFUnit::GetLocationTable(), lldb_private::Thread::GetSiginfoValue(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), ELFLinuxPrPsInfo::Parse(), ELFNote::Parse(), lldb_private::DWARFExpression::ParseDWARFLocationList(), lldb_private::SymbolFileCTF::ParseHeader(), ObjectFileMachO::ParseSymtab(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), RegisterContextCorePOSIX_powerpc::ReadRegister(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegister(), RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(), RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(), RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(), RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(), SetData(), lldb_private::ValueObject::SetData(), ABISysV_ppc::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABIWindows_x86_64::SetReturnValueObject(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::Scalar::SetValueFromData(), lldb_private::RegisterValue::SetValueFromData(), lldb_private::DWARFExpression::Update_DW_OP_addr(), lldb_private::ValueObject::ValueObject(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().

◆ GetByteSize()

uint64_t lldb_private::DataExtractor::GetByteSize ( ) const
inline

Get the number of bytes contained in this object.

Returns
The total number of bytes of data this object refers to.

Definition at line 270 of file DataExtractor.h.

References m_end, and m_start.

Referenced by Append(), BytesLeft(), calc_crc32(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Checksum(), RegisterContextCorePOSIX_arm64::ConfigureRegisterContext(), Copy(), RegisterContextCorePOSIX_arm64::Create(), lldb_private::plugin::dwarf::AppleDWARFIndex::Create(), DataExtractor(), lldb_private::plugin::dwarf::SymbolFileDWARF::DebugAbbrev(), DisassemblerLLVMC::DecodeInstructions(), EntityVariableBase::Dematerialize(), EntityRegister::Dematerialize(), lldb_private::IRExecutionUnit::DisassembleFunction(), CommandObjectProcessKDPPacketSend::DoExecute(), lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), PECallFrameInfo::FindRuntimeFunctionIntersectsWithRange(), lldb_private::TypeFormatImpl_EnumType::FormatObject(), lldb_private::DWARFDataExtractor::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), lldb_private::Scalar::GetAsMemoryData(), ProcessElfCore::GetAuxvData(), GetData(), lldb_private::ValueObject::GetData(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDebugRanges(), lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetDIENamesAndRanges(), lldb_private::DWARFExpression::GetExpressionData(), GetExprListFromAtLocation(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), lldb_private::ProcessStructReader::GetField(), lldb_private::ObjectFile::GetLoadableData(), UnwindCodesIterator::GetNext(), lldb_private::ObjectContainerMachOFileset::GetObjectFile(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_ppc::GetReturnValueObjectImpl(), ABISysV_x86_64::GetReturnValueObjectImpl(), ABIWindows_x86_64::GetReturnValueObjectImpl(), EmulateInstructionMIPS::GetSizeOfInstruction(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), lldb_private::plugin::dwarf::SymbolFileDWARF::InitializeObject(), lldb_private::DWARFExpression::IsValid(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), EntityVariableBase::Materialize(), EntityRegister::Materialize(), ELFLinuxPrStatus::Parse(), ELFLinuxSigInfo::Parse(), ELFLinuxPrPsInfo::Parse(), lldb_private::plugin::dwarf::SymbolFileDWARF::ParseDebugMacros(), ObjectFileELF::ParseDependentModules(), ObjectFileELF::ParseDynamicSymbols(), ProcessElfCore::parseFreeBSDNotes(), ParseFreeBSDPrStatus(), lldb_private::SymbolFileCTF::ParseHeader(), ObjectContainerBSDArchive::ParseHeader(), ObjectFileMachO::ParseHeader(), lldb_private::ObjectContainerMachOFileset::ParseHeader(), ProcessElfCore::parseLinuxNotes(), ProcessElfCore::parseNetBSDNotes(), ObjectContainerBSDArchive::Archive::ParseObjects(), ProcessElfCore::parseOpenBSDNotes(), ProcessElfCore::parseSegment(), ObjectFileELF::ParseSymbolTable(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), lldb_private::Type::ReadFromMemory(), lldb_private::ValueObject::ReadPointedString(), RegisterContextCorePOSIX_arm64::ReadRegister(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), lldb_private::ObjectFileJIT::ReadSectionData(), lldb_private::ObjectFile::ReadSectionData(), RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(), RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(), RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(), RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(), lldb_private::Value::ResolveValue(), lldb_private::CompactUnwindInfo::ScanIndex(), CommunicationKDP::SendRequestReadMemory(), CommunicationKDP::SendRequestReadRegisters(), SetData(), lldb_private::Scalar::SetValueFromData(), lldb_private::RegisterValue::SetValueFromData(), lldb_private::DWARFExpression::Update_DW_OP_addr(), lldb_private::ValueObjectVariable::UpdateValue(), ValidOffset(), lldb_private::ValueObjectConstResult::ValueObjectConstResult(), InstructionLLVMC::VisitInstruction(), CommunicationKDP::WaitForPacketWithTimeoutMicroSecondsNoLock(), lldb_private::Watchpoint::WatchedValueReportable(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteAllRegisterValues(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegister(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().

◆ GetCStr() [1/2]

const char * DataExtractor::GetCStr ( lldb::offset_t offset_ptr) const

Extract a C string from *offset_ptr.

Returns a pointer to a C String from the data at the offset pointed to by offset_ptr. A variable length NULL terminated C string will be extracted and the offset_ptr will be updated with the offset of the byte that follows the NULL terminator byte.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
A pointer to the C string value in the data. If the offset pointed to by offset_ptr is out of bounds, or if the offset plus the length of the C string is out of bounds, nullptr will be returned.

Definition at line 785 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), SystemRuntimeMacOSX::ExtractItemInfoFromBuffer(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), ObjectFileMachO::GetCorefileAllImageInfos(), GetDebugLinkContents(), GetFreeBSDProcessArgs(), GetMacOSXProcessArgs(), GetNetBSDProcessArgs(), GetOpenBSDProcessArgs(), ObjectFileELF::GetSectionHeaderInfo(), ObjectFilePECOFF::GetSectionName(), ELFNote::Parse(), ObjectFileELF::ParseARMAttributes(), ParseFileset(), ParseTrieEntries(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), lldb_private::plugin::dwarf::DWARFDebugMacroEntry::ReadMacroEntries(), lldb_private::SymbolFileCTF::ReadString(), ObjectFileELF::RefineModuleDetailsFromNote(), and lldb_private::plugin::dwarf::DWARFFormValue::SkipValue().

◆ GetCStr() [2/2]

const char * DataExtractor::GetCStr ( lldb::offset_t offset_ptr,
lldb::offset_t  len 
) const

Extract a C string from *offset_ptr with field size len.

Returns a pointer to a C String from the data at the offset pointed to by offset_ptr, with a field length of len. A NULL terminated C string will be extracted and the offset_ptr will be updated with the offset of the byte that follows the fixed length field.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
A pointer to the C string value in the data. If the offset pointed to by offset_ptr is out of bounds, or if the offset plus the length of the field is out of bounds, or if the field does not contain a NULL terminator byte, nullptr will be returned.

Definition at line 815 of file DataExtractor.cpp.

References PeekData().

◆ GetData() [1/2]

llvm::ArrayRef< uint8_t > lldb_private::DataExtractor::GetData ( ) const
inline

Definition at line 983 of file DataExtractor.h.

References GetByteSize(), and GetDataStart().

Referenced by Get(), GetAsLLVM(), GetMaxU64(), GetU16(), GetU32(), GetU64(), and GetU8().

◆ GetData() [2/2]

const void * lldb_private::DataExtractor::GetData ( lldb::offset_t offset_ptr,
lldb::offset_t  length 
) const
inline

Extract length bytes from *offset_ptr.

Returns a pointer to a bytes in this object's data at the offset pointed to by offset_ptr. If length is zero or too large, then the offset pointed to by offset_ptr will not be updated and nullptr will be returned.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]lengthThe optional length of a string to extract. If the value is zero, a NULL terminated C string will be extracted.
Returns
A pointer to the bytes in this object's data if the offset and length are valid, or nullptr otherwise.

Definition at line 337 of file DataExtractor.h.

References PeekData().

Referenced by ObjectFilePECOFF::CreateBinary(), lldb_private::breakpad::ObjectFileBreakpad::CreateSections(), lldb_private::CacheSignature::Decode(), lldb_private::StringTableReader::Decode(), lldb_private::plugin::dwarf::ManualDWARFIndex::IndexSet::Decode(), lldb_private::Symtab::Decode(), lldb_private::plugin::dwarf::NameToDIE::Decode(), DecodeCStrMap(), EntityRegister::Dematerialize(), lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), Evaluate_DW_OP_entry_value(), ObjectFileMachO::GetCorefileAllImageInfos(), ObjectFileELF::GetGnuDebugDataObjectFile(), lldb_private::plugin::dwarf::DWARFUnit::GetLocationTable(), lldb_private::DWARFCallFrameInfo::HandleCommonDwarfOpcode(), lldb_private::platform_android::AdbClient::SyncService::internalStat(), lldb_private::breakpad::SymbolFileBreakpad::LineIterator::LineIterator(), lldb_private::breakpad::SymbolFileBreakpad::LineIterator::operator++(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), DynamicLoaderDarwinKernel::ReadKextSummaries(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), CommunicationKDP::SendRequestReadMemory(), CommunicationKDP::SendRequestReadRegisters(), ABISysV_arc::SetReturnValueObject(), ABISysV_riscv::SetReturnValueObject(), TypedRead(), lldb_private::DWARFExpression::Update_DW_OP_addr(), and lldb_private::Watchpoint::WatchedValueReportable().

◆ GetDataEnd()

const uint8_t * lldb_private::DataExtractor::GetDataEnd ( ) const
inline

Get the data end pointer.

Returns
Returns a pointer to the next byte contained in this object's data, or nullptr of there is no data in this object.

Definition at line 406 of file DataExtractor.h.

References m_end.

Referenced by lldb_private::breakpad::ObjectFileBreakpad::CreateSections().

◆ GetDataStart()

const uint8_t * lldb_private::DataExtractor::GetDataStart ( ) const
inline

Get the data start pointer.

Returns
Returns a pointer to the first byte contained in this object's data, or nullptr of there is no data in this object.

Definition at line 422 of file DataExtractor.h.

References m_start.

Referenced by Append(), calc_crc32(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Checksum(), lldb_private::breakpad::ObjectFileBreakpad::CreateSections(), EntityVariableBase::Dematerialize(), EntityRegister::Dematerialize(), CommandObjectProcessKDPPacketSend::DoExecute(), EmulateInstructionMIPS::EvaluateInstruction(), EmulateInstructionMIPS64::EvaluateInstruction(), ExtractDataMemberLocation(), lldb_private::DWARFDataExtractor::GetAsLLVM(), lldb_private::DWARFDataExtractor::GetAsLLVMDWARF(), ProcessElfCore::GetAuxvData(), GetData(), lldb_private::plugin::dwarf::DWARFDebugInfoEntry::GetDIENamesAndRanges(), lldb_private::ArmUnwindInfo::GetExceptionHandlingTableEntry(), GetExprListFromAtConstValue(), GetExprListFromAtLocation(), lldb_private::ObjectFile::GetLoadableData(), EmulateInstructionMIPS::GetSizeOfInstruction(), RegisterContextCorePOSIX_arm64::GetSVEBuffer(), lldb_private::ClangExpressionDeclMap::GetVariableValue(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), EntityVariableBase::Materialize(), EntityRegister::Materialize(), lldb_private::SymbolFileCTF::ParseHeader(), ObjectContainerBSDArchive::Archive::ParseObjects(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), RegisterContextCorePOSIX_arm64::ReadRegister(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(), RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(), RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(), RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(), SetData(), lldb_private::ValueObject::SetData(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::Scalar::SetValueFromData(), lldb_private::DWARFExpression::Update_DW_OP_addr(), lldb_private::ValueObjectRegister::UpdateValue(), lldb_private::ValueObjectVariable::UpdateValue(), lldb_private::ValueObjectConstResult::ValueObjectConstResult(), InstructionLLVMC::VisitInstruction(), and lldb_private::Watchpoint::WatchedValueReportable().

◆ GetDouble()

double DataExtractor::GetDouble ( lldb::offset_t offset_ptr) const

◆ GetFloat()

float DataExtractor::GetFloat ( lldb::offset_t offset_ptr) const

Extract a float from *offset_ptr.

Extract a single float value.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The floating value that was extracted, or zero on failure.

Definition at line 623 of file DataExtractor.cpp.

Referenced by lldb_private::DumpDataExtractor(), InterpreterStackFrame::EvaluateValue(), ABIMacOSX_arm64::GetReturnValueObjectImpl(), ABISysV_arm64::GetReturnValueObjectImpl(), ABISysV_mips::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_ppc::GetReturnValueObjectSimple(), ABISysV_s390x::GetReturnValueObjectSimple(), ABISysV_x86_64::GetReturnValueObjectSimple(), ABIWindows_x86_64::GetReturnValueObjectSimple(), RegisterContextDarwin_arm64::ReadRegister(), ABISysV_i386::SetReturnValueObject(), lldb_private::Scalar::SetValueFromData(), and lldb_private::RegisterValue::SetValueFromData().

◆ GetLongDouble()

long double DataExtractor::GetLongDouble ( lldb::offset_t offset_ptr) const

◆ GetMaxS64()

int64_t DataExtractor::GetMaxS64 ( lldb::offset_t offset_ptr,
size_t  byte_size 
) const

Extract an signed integer of size byte_size from *offset_ptr.

Extract a single signed integer value (sign extending if required) and update the offset pointed to by offset_ptr. The size of the extracted integer is specified by the byte_size argument. byte_size must have a value greater than or equal to one and less than or equal to eight since the return value is 64 bits wide.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]byte_sizeThe size in byte of the integer to extract.
Returns
The sign extended signed integer value that was extracted, or zero on failure.

Definition at line 569 of file DataExtractor.cpp.

References GetMaxU64().

Referenced by GetMaxS64(), GetMaxS64Bitfield(), and lldb_private::CompilerType::GetValueAsScalar().

◆ GetMaxS64Bitfield()

int64_t DataExtractor::GetMaxS64Bitfield ( lldb::offset_t offset_ptr,
size_t  size,
uint32_t  bitfield_bit_size,
uint32_t  bitfield_bit_offset 
) const

Extract an signed integer of size size from *offset_ptr, then extract and sign-extend the bitfield from this value if bitfield_bit_size is non-zero.

Extract a single signed integer value (sign-extending if required) and update the offset pointed to by offset_ptr. The size of the extracted integer is specified by the size argument. size must have a value greater than or equal to one and less than or equal to eight since the return value is 64 bits wide.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]sizeThe size in bytes of the integer to extract.
[in]bitfield_bit_sizeThe size in bits of the bitfield value to extract, or zero to just extract the entire integer value.
[in]bitfield_bit_offsetThe bit offset of the bitfield value in the extracted integer. For little-endian data, this is the offset of the LSB of the bitfield from the LSB of the integer. For big-endian data, this is the offset of the MSB of the bitfield from the MSB of the integer.
Returns
The signed bitfield integer value that was extracted, or zero on failure.

Definition at line 602 of file DataExtractor.cpp.

References lldb::eByteOrderBig, GetMaxS64(), and m_byte_order.

Referenced by lldb_private::DumpDataExtractor(), and DumpEnumValue().

◆ GetMaxU32()

uint32_t DataExtractor::GetMaxU32 ( lldb::offset_t offset_ptr,
size_t  byte_size 
) const

Extract an integer of size byte_size from *offset_ptr.

Extract a single integer value and update the offset pointed to by offset_ptr. The size of the extracted integer is specified by the byte_size argument. byte_size must have a value >= 1 and <= 4 since the return value is only 32 bits wide.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]byte_sizeThe size in byte of the integer to extract.
Returns
The integer value that was extracted, or zero on failure.

Definition at line 519 of file DataExtractor.cpp.

References GetMaxU64(), and lldbassert.

Referenced by lldb_private::Target::ReadScalarIntegerFromMemory(), lldb_private::Process::ReadScalarIntegerFromMemory(), ABIMacOSX_arm::SetReturnValueObject(), ABISysV_arm::SetReturnValueObject(), ABISysV_mips::SetReturnValueObject(), ABIMacOSX_i386::SetReturnValueObject(), ABISysV_i386::SetReturnValueObject(), and lldb_private::RegisterValue::SetValueFromData().

◆ GetMaxU64()

uint64_t DataExtractor::GetMaxU64 ( lldb::offset_t offset_ptr,
size_t  byte_size 
) const

Extract an unsigned integer of size byte_size from *offset_ptr.

Extract a single unsigned integer value and update the offset pointed to by offset_ptr. The size of the extracted integer is specified by the byte_size argument. byte_size must have a value greater than or equal to one and less than or equal to eight since the return value is 64 bits wide.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]byte_sizeThe size in byte of the integer to extract.
Returns
The unsigned integer value that was extracted, or zero on failure.

Definition at line 525 of file DataExtractor.cpp.

References GetData(), GetU16(), GetU32(), GetU64(), GetU8(), lldbassert, m_byte_order, and ReadMaxInt64().

Referenced by lldb_private::plugin::dwarf::DWARFFormValue::Address(), DerefSizeExtractDataHelper(), InterpreterStackFrame::EvaluateValue(), lldb_private::plugin::dwarf::DWARFDebugArangeSet::extract(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::plugin::dwarf::DWARFUnit::FindRnglistFromOffset(), GetAddress(), GetAPInt(), lldb_private::DWARFDataExtractor::GetDWARFOffset(), lldb_private::ProcessStructReader::GetField(), GetMaxS64(), GetMaxU32(), GetMaxU64(), GetMaxU64Bitfield(), lldb_private::CompilerType::GetValueAsScalar(), ELFLinuxPrPsInfo::Parse(), ObjectFilePECOFF::ParseCOFFOptionalHeader(), lldb_private::EmulateInstruction::ReadMemoryUnsigned(), RegisterContextDarwin_arm64::ReadRegister(), RegisterContextCorePOSIX_arm::ReadRegister(), RegisterContextCorePOSIX_mips64::ReadRegister(), RegisterContextCorePOSIX_powerpc::ReadRegister(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), RegisterContextCorePOSIX_s390x::ReadRegister(), lldb_private::Target::ReadScalarIntegerFromMemory(), lldb_private::Process::ReadScalarIntegerFromMemory(), ABIMacOSX_arm64::SetReturnValueObject(), ABISysV_arm64::SetReturnValueObject(), ABISysV_arc::SetReturnValueObject(), ABIMacOSX_arm::SetReturnValueObject(), ABISysV_mips64::SetReturnValueObject(), ABISysV_ppc::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_riscv::SetReturnValueObject(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABIWindows_x86_64::SetReturnValueObject(), and lldb_private::RegisterValue::SetValueFromData().

◆ GetMaxU64_unchecked()

uint64_t DataExtractor::GetMaxU64_unchecked ( lldb::offset_t offset_ptr,
size_t  byte_size 
) const

◆ GetMaxU64Bitfield()

uint64_t DataExtractor::GetMaxU64Bitfield ( lldb::offset_t offset_ptr,
size_t  size,
uint32_t  bitfield_bit_size,
uint32_t  bitfield_bit_offset 
) const

Extract an unsigned integer of size byte_size from *offset_ptr, then extract the bitfield from this value if bitfield_bit_size is non-zero.

Extract a single unsigned integer value and update the offset pointed to by offset_ptr. The size of the extracted integer is specified by the byte_size argument. byte_size must have a value greater than or equal to one and less than or equal to 8 since the return value is 64 bits wide.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[in]sizeThe size in byte of the integer to extract.
[in]bitfield_bit_sizeThe size in bits of the bitfield value to extract, or zero to just extract the entire integer value.
[in]bitfield_bit_offsetThe bit offset of the bitfield value in the extracted integer. For little-endian data, this is the offset of the LSB of the bitfield from the LSB of the integer. For big-endian data, this is the offset of the MSB of the bitfield from the MSB of the integer.
Returns
The unsigned bitfield integer value that was extracted, or zero on failure.

Definition at line 574 of file DataExtractor.cpp.

References lldb::eByteOrderBig, GetMaxU64(), and m_byte_order.

Referenced by lldb_private::DumpDataExtractor(), and DumpEnumValue().

◆ GetSharedDataBuffer()

lldb::DataBufferSP & lldb_private::DataExtractor::GetSharedDataBuffer ( )
inline

◆ GetSharedDataOffset()

size_t DataExtractor::GetSharedDataOffset ( ) const

Get the shared data offset.

Get the offset of the first byte of data in the shared data (if any).

Returns
If this object contains shared data, this function returns the offset in bytes into that shared data, zero otherwise.

Definition at line 203 of file DataExtractor.cpp.

References lldb_private::DataBuffer::GetBytes(), m_data_sp, and m_start.

Referenced by SetData().

◆ GetSLEB128()

int64_t DataExtractor::GetSLEB128 ( lldb::offset_t offset_ptr) const

Extract a signed LEB128 value from *offset_ptr.

Extracts an signed LEB128 number from this object's data starting at the offset pointed to by offset_ptr. The offset pointed to by offset_ptr will be updated with the offset of the byte following the last extracted byte.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted signed integer value.

Definition at line 860 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by lldb_private::DWARFExpression::Evaluate(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), GetGNUEHPointer(), lldb_private::DWARFCallFrameInfo::HandleCommonDwarfOpcode(), lldb_private::DWARFExpression::MatchesOperand(), lldb_private::DWARFCallFrameInfo::ParseCIE(), and PutToLog().

◆ getTargetByteSize()

uint32_t lldb_private::DataExtractor::getTargetByteSize ( ) const
inline

Definition at line 170 of file DataExtractor.h.

References m_target_byte_size.

Referenced by lldb_private::DumpDataExtractor().

◆ GetU16() [1/2]

uint16_t DataExtractor::GetU16 ( lldb::offset_t offset_ptr) const

Extract a uint16_t value from *offset_ptr.

Extract a single uint16_t from the binary data at the offset pointed to by offset_ptr, and update the offset on success.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted uint16_t value.

Definition at line 348 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, ReadInt16(), and ReadSwapInt16().

Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), RegisterContextCorePOSIX_arm64::ConfigureRegisterContext(), lldb_private::Symbol::Decode(), InstructionLLVMC::Decode(), lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), lldb_private::plugin::dwarf::DWARFUnitHeader::extract(), lldb_private::plugin::dwarf::DWARFDebugArangeSet::extract(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), lldb_private::CompactUnwindInfo::GetCompactUnwindInfoForFunction(), GetGNUEHPointer(), GetMaxU64(), ObjectFilePECOFF::MagicBytesMatch(), ELFLinuxPrStatus::Parse(), elf::ELFSymbol::Parse(), elf::ELFHeader::Parse(), ObjectFilePECOFF::ParseCOFFHeader(), ObjectFilePECOFF::ParseCOFFOptionalHeader(), ObjectFilePECOFF::ParseDOSHeader(), lldb_private::SymbolFileCTF::ParseHeader(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::ParseHeader(), lldb_private::SymbolFileCTF::ParseType(), PutToLog(), lldb_private::IRMemoryMap::ReadScalarFromMemory(), lldb_private::plugin::dwarf::DWARFUnit::SetDwoStrOffsetsBase(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion(), and lldb_private::plugin::dwarf::DWARFFormValue::SkipValue().

◆ GetU16() [2/2]

void * DataExtractor::GetU16 ( lldb::offset_t offset_ptr,
void *  dst,
uint32_t  count 
) const

Extract count uint16_t values from *offset_ptr.

Extract count uint16_t values from the binary data at the offset pointed to by offset_ptr, and advance the offset on success. The extracted values are copied into dst.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[out]dstA buffer to copy count uint16_t values into. dst must be large enough to hold all requested data.
[in]countThe number of uint16_t values to extract.
Returns
dst if all values were properly extracted and copied, nullptr otherwise.

Definition at line 397 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, and ReadSwapInt16().

◆ GetU16_unchecked()

uint16_t DataExtractor::GetU16_unchecked ( lldb::offset_t offset_ptr) const

◆ GetU32() [1/2]

uint32_t DataExtractor::GetU32 ( lldb::offset_t offset_ptr) const

Extract a uint32_t value from *offset_ptr.

Extract a single uint32_t from the binary data at the offset pointed to by offset_ptr, and update the offset on success.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted uint32_t value.

Definition at line 426 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, and ReadSwapInt32().

Referenced by lldb_private::ArmUnwindInfo::ArmUnwindInfo(), lldb_private::CompactUnwindInfo::BinarySearchCompressedSecondPage(), lldb_private::CompactUnwindInfo::BinarySearchRegularSecondPage(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), RegisterContextCorePOSIX_arm64::ConfigureRegisterContext(), ObjectFileMachO::CreateSections(), lldb_private::CacheSignature::Decode(), lldb_private::StringTableReader::Decode(), lldb_private::plugin::dwarf::ManualDWARFIndex::IndexSet::Decode(), lldb_private::Symtab::Decode(), lldb_private::Symbol::Decode(), lldb_private::Mangled::Decode(), lldb_private::plugin::dwarf::NameToDIE::Decode(), InstructionLLVMC::Decode(), DecodeCStrMap(), CommandObjectProcessMinidumpDump::DoExecute(), DynamicLoaderMacOSXDYLD::DoInitialImageFetch(), lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), SystemRuntimeMacOSX::ExtractItemInfoFromBuffer(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), ObjectFileMachO::FindLC_NOTEByName(), FindMinimumVersionInfo(), ObjectFileMachO::GetAddressableBits(), ObjectFileMachO::GetAllArchSpecs(), lldb_private::CompactUnwindInfo::GetCompactUnwindInfoForFunction(), ObjectFileMachO::GetCorefileAllImageInfos(), ObjectFileMachO::GetCorefileMainBinaryInfo(), GetDebugLinkContents(), ObjectFileMachO::GetDependentModules(), lldb_private::DWARFDataExtractor::GetDWARFInitialLength(), ObjectFileMachO::GetEncryptedFileRanges(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), GetGNUEHPointer(), ObjectFileMachO::GetIdentifierString(), lldb_private::CompactUnwindInfo::GetLSDAForFunctionOffset(), GetMacOSXProcessArgs(), GetMaxU64(), ObjectFileMachO::GetNumThreadContexts(), SystemRuntimeMacOSX::GetPendingItemRefsForQueue(), ObjectFileELF::GetSectionHeaderInfo(), lldb_private::plugin::dwarf::DWARFUnit::GetStringOffsetSectionItem(), ObjectFileMachO::GetUUID(), lldb_private::CompilerType::GetValueAsScalar(), ObjectFileMachO::GetVersion(), lldb_private::platform_android::AdbClient::SyncService::internalStat(), ObjectFileMachO::IsStripped(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), lldb_private::ObjectContainerMachOFileset::MagicBytesMatch(), ObjectContainerUniversalMachO::MagicBytesMatch(), ObjectFileMachO::MagicBytesMatch(), ELFLinuxPrStatus::Parse(), ELFLinuxSigInfo::Parse(), ELFLinuxPrPsInfo::Parse(), elf::ELFSectionHeader::Parse(), elf::ELFProgramHeader::Parse(), elf::ELFSymbol::Parse(), ELFNote::Parse(), elf::ELFHeader::Parse(), ObjectFileELF::ParseARMAttributes(), lldb_private::DWARFCallFrameInfo::ParseCIE(), lldb_private::AppleObjCRuntimeV2::ParseClassInfoArray(), ObjectFilePECOFF::ParseCOFFHeader(), ObjectFilePECOFF::ParseCOFFOptionalHeader(), ObjectFilePECOFF::ParseDOSHeader(), ParseFileset(), ParseFreeBSDPrPsInfo(), ParseFreeBSDPrStatus(), lldb_private::SymbolFileCTF::ParseFunctions(), lldb_private::SymbolFileCTF::ParseHeader(), ObjectFilePECOFF::ParseHeader(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::ParseHeader(), ObjectFileMachO::ParseHeader(), ObjectContainerUniversalMachO::ParseHeader(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ParseMachOHeader(), ParseNetBSDProcInfo(), lldb_private::SymbolFileCTF::ParseObjects(), ParseOpenBSDProcInfo(), ObjectFileMachO::ParseSymtab(), lldb_private::SymbolFileCTF::ParseType(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), ObjectFileMachO::ProcessDysymtabCommand(), ObjectFileMachO::ProcessSegmentCommand(), PutToLog(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DynamicLoaderDarwinKernel::ReadKextSummaryHeader(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::plugin::dwarf::DWARFDebugMacroEntry::ReadMacroEntries(), RegisterContextCorePOSIX_arm64::ReadRegister(), lldb_private::IRMemoryMap::ReadScalarFromMemory(), lldb_private::platform_android::AdbClient::SyncService::ReadSyncHeader(), ObjectFileELF::RefineModuleDetailsFromNote(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), lldb_private::minidump::RegisterContextMinidump_ARM::RegisterContextMinidump_ARM(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), lldb_private::CompactUnwindInfo::ScanIndex(), DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints(), CommunicationKDP::SendRawRequest(), CommunicationKDP::SendRequestBreakpoint(), CommunicationKDP::SendRequestHostInfo(), CommunicationKDP::SendRequestReadMemory(), CommunicationKDP::SendRequestReadRegisters(), CommunicationKDP::SendRequestReattach(), CommunicationKDP::SendRequestVersion(), CommunicationKDP::SendRequestWriteMemory(), CommunicationKDP::SendRequestWriteRegisters(), lldb_private::plugin::dwarf::DWARFUnit::SetDwoStrOffsetsBase(), RegisterContextDarwin_x86_64_Mach::SetRegisterDataFrom_LC_THREAD(), RegisterContextDarwin_i386_Mach::SetRegisterDataFrom_LC_THREAD(), RegisterContextDarwin_arm_Mach::SetRegisterDataFrom_LC_THREAD(), RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD(), ThreadKDP::SetStopInfoFrom_KDP_EXCEPTION(), lldb_private::AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion(), lldb_private::plugin::dwarf::DWARFFormValue::SkipValue(), and lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded().

◆ GetU32() [2/2]

void * DataExtractor::GetU32 ( lldb::offset_t offset_ptr,
void *  dst,
uint32_t  count 
) const

Extract count uint32_t values from *offset_ptr.

Extract count uint32_t values from the binary data at the offset pointed to by offset_ptr, and advance the offset on success. The extracted values are copied into dst.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[out]dstA buffer to copy count uint32_t values into. dst must be large enough to hold all requested data.
[in]countThe number of uint32_t values to extract.
Returns
dst if all values were properly extracted and copied, nullptr otherwise.

Definition at line 446 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, and ReadSwapInt32().

◆ GetU32_unchecked()

uint32_t DataExtractor::GetU32_unchecked ( lldb::offset_t offset_ptr) const

◆ GetU64() [1/2]

uint64_t DataExtractor::GetU64 ( lldb::offset_t offset_ptr) const

Extract a uint64_t value from *offset_ptr.

Extract a single uint64_t from the binary data at the offset pointed to by offset_ptr, and update the offset on success.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted uint64_t value.

Definition at line 475 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, and ReadSwapInt64().

Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::plugin::dwarf::DIERef::Decode(), lldb_private::Symbol::Decode(), InstructionLLVMC::Decode(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), lldb_private::plugin::dwarf::DWARFUnitHeader::extract(), SystemRuntimeMacOSX::ExtractItemInfoFromBuffer(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), GetAPInt(), ObjectFileMachO::GetCorefileAllImageInfos(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::DWARFCallFrameInfo::GetFDEIndex(), GetGNUEHPointer(), GetMaxU64(), ABISysV_mips64::GetReturnValueObjectImpl(), lldb_private::CompilerType::GetValueAsScalar(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), elf::ELFSymbol::Parse(), lldb_private::DWARFCallFrameInfo::ParseCIE(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::ParseHeader(), ObjectContainerUniversalMachO::ParseHeader(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), PutToLog(), ReadJITEntry(), DynamicLoaderDarwinKernel::ReadKextSummaries(), lldb_private::plugin::dwarf::DWARFDebugMacroEntry::ReadMacroEntries(), lldb_private::IRMemoryMap::ReadScalarFromMemory(), ReadUIntMax64(), lldb_private::minidump::RegisterContextMinidump_ARM::RegisterContextMinidump_ARM(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints(), lldb_private::plugin::dwarf::DWARFUnit::SetDwoStrOffsetsBase(), RegisterContextDarwin_x86_64_Mach::SetRegisterDataFrom_LC_THREAD(), RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD(), lldb_private::RegisterValue::SetValueFromData(), and lldb_private::AppleObjCRuntimeV2::SharedCacheClassInfoExtractor::UpdateISAToDescriptorMap().

◆ GetU64() [2/2]

void * DataExtractor::GetU64 ( lldb::offset_t offset_ptr,
void *  dst,
uint32_t  count 
) const

Extract count uint64_t values from *offset_ptr.

Extract count uint64_t values from the binary data at the offset pointed to by offset_ptr, and advance the offset on success. The extracted values are copied into dst.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[out]dstA buffer to copy count uint64_t values into. dst must be large enough to hold all requested data.
[in]countThe number of uint64_t values to extract.
Returns
dst if all values were properly extracted and copied, nullptr otherwise.

Definition at line 494 of file DataExtractor.cpp.

References GetData(), lldb_private::endian::InlHostByteOrder(), m_byte_order, and ReadSwapInt64().

◆ GetU64_unchecked()

uint64_t DataExtractor::GetU64_unchecked ( lldb::offset_t offset_ptr) const

◆ GetU8() [1/2]

uint8_t DataExtractor::GetU8 ( lldb::offset_t offset_ptr) const

Extract a uint8_t value from *offset_ptr.

Extract a single uint8_t from the binary data at the offset pointed to by offset_ptr, and advance the offset on success.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted uint8_t value.

Definition at line 317 of file DataExtractor.cpp.

References GetData().

Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), lldb_private::DWARFExpression::ContainsThreadLocalStorage(), lldb_private::CacheSignature::Decode(), lldb_private::plugin::dwarf::ManualDWARFIndex::IndexSet::Decode(), lldb_private::Symtab::Decode(), lldb_private::Symbol::Decode(), lldb_private::Mangled::Decode(), InstructionLLVMC::Decode(), lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), lldb_private::plugin::dwarf::DWARFUnitHeader::extract(), lldb_private::plugin::dwarf::DWARFDebugArangeSet::extract(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), GetMaxU64(), ObjectFileELF::GetSectionHeaderInfo(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), lldb_private::ObjectFileJSON::MagicBytesMatch(), lldb_private::DWARFExpression::MatchesOperand(), ELFLinuxPrPsInfo::Parse(), elf::ELFSymbol::Parse(), elf::ELFHeader::Parse(), ObjectFileELF::ParseARMAttributes(), lldb_private::DWARFCallFrameInfo::ParseCIE(), ObjectFilePECOFF::ParseCOFFOptionalHeader(), lldb_private::SymbolFileCTF::ParseHeader(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::ParseHeader(), ParseTrieEntries(), ObjectFileMachO::ProcessSegmentCommand(), PutToLog(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), lldb_private::plugin::dwarf::DWARFDebugMacroEntry::ReadMacroEntries(), lldb_private::IRMemoryMap::ReadScalarFromMemory(), CommunicationKDP::SendRequestAndGetReply(), ThreadKDP::SetStopInfoFrom_KDP_EXCEPTION(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::SkipOperandTable(), lldb_private::plugin::dwarf::DWARFFormValue::SkipValue(), and lldb_private::DWARFExpression::Update_DW_OP_addr().

◆ GetU8() [2/2]

void * DataExtractor::GetU8 ( lldb::offset_t offset_ptr,
void *  dst,
uint32_t  count 
) const

Extract count uint8_t values from *offset_ptr.

Extract count uint8_t values from the binary data at the offset pointed to by offset_ptr, and advance the offset on success. The extracted values are copied into dst.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
[out]dstA buffer to copy count uint8_t values into. dst must be large enough to hold all requested data.
[in]countThe number of uint8_t values to extract.
Returns
dst if all values were properly extracted and copied, nullptr otherwise.

Definition at line 330 of file DataExtractor.cpp.

References GetData().

◆ GetU8_unchecked()

uint8_t lldb_private::DataExtractor::GetU8_unchecked ( lldb::offset_t offset_ptr) const
inline

Definition at line 612 of file DataExtractor.h.

References m_start.

Referenced by GetMaxU64_unchecked(), and ParseNList().

◆ GetULEB128()

uint64_t DataExtractor::GetULEB128 ( lldb::offset_t offset_ptr) const

Extract a unsigned LEB128 value from *offset_ptr.

Extracts an unsigned LEB128 number from this object's data starting at the offset pointed to by offset_ptr. The offset pointed to by offset_ptr will be updated with the offset of the byte following the last extracted byte.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The extracted unsigned integer value.

Definition at line 843 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by lldb_private::DWARFExpression::Evaluate(), Evaluate_DW_OP_entry_value(), lldb_private::plugin::dwarf::DWARFDebugInfoEntry::Extract(), lldb_private::plugin::dwarf::DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::FDEToUnwindPlan(), GetGNUEHPointer(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), GetOpcodeDataSize(), lldb_private::DWARFCallFrameInfo::HandleCommonDwarfOpcode(), lldb_private::DWARFExpression::MatchesOperand(), ObjectFileELF::ParseARMAttributes(), lldb_private::DWARFCallFrameInfo::ParseCIE(), ParseTrieEntries(), PutToLog(), lldb_private::plugin::dwarf::DWARFDebugMacroEntry::ReadMacroEntries(), lldb_private::plugin::dwarf::DWARFDebugMacroHeader::SkipOperandTable(), lldb_private::plugin::dwarf::DWARFFormValue::SkipValue(), and lldb_private::DWARFExpression::Update_DW_OP_addr().

◆ operator=() [1/2]

const DataExtractor & DataExtractor::operator= ( const DataExtractor rhs)

Assignment operator.

Copies all data, byte order and address size settings from rhs into this object. If rhs contains shared data, a reference to that shared data will be added.

Parameters
[in]rhsAnother DataExtractor object to copy.
Returns
A const reference to this object.

Definition at line 178 of file DataExtractor.cpp.

References m_addr_size, m_byte_order, m_data_sp, m_end, and m_start.

◆ operator=() [2/2]

DataExtractor & lldb_private::DataExtractor::operator= ( DataExtractor &&  rhs)
default

◆ PeekCStr()

const char * DataExtractor::PeekCStr ( lldb::offset_t  offset) const

Peek at a C string at offset.

Peeks at a string in the contained data. No verification is done to make sure the entire string lies within the bounds of this object's data, only offset is verified to be a valid offset.

Parameters
[in]offsetAn offset into the data.
Returns
A non-nullptr C string pointer if offset is a valid offset, nullptr otherwise.

Definition at line 833 of file DataExtractor.cpp.

References PeekData().

Referenced by lldb_private::plugin::dwarf::DWARFFormValue::AsCString(), elf::ELFSymbol::Dump(), CommunicationKDP::DumpPacket(), ObjectFileMachO::GetDependentModules(), ObjectFileELF::GetSectionHeaderInfo(), ObjectFileELF::ParseDependentModules(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ParsePLTRelocations(), ObjectFileELF::ParseSymbols(), ObjectFileMachO::ParseSymtab(), lldb_private::ValueObject::ReadPointedString(), and CommunicationKDP::SendRequestKernelVersion().

◆ PeekData()

const uint8_t * lldb_private::DataExtractor::PeekData ( lldb::offset_t  offset,
lldb::offset_t  length 
) const
inline

◆ PutToLog()

lldb::offset_t DataExtractor::PutToLog ( Log log,
lldb::offset_t  offset,
lldb::offset_t  length,
uint64_t  base_addr,
uint32_t  num_per_line,
DataExtractor::Type  type 
) const

Dumps the binary data as type objects to stream s (or to Log() if s is nullptr) starting offset bytes into the data and stopping after dumping length bytes.

The offset into the data is displayed at the beginning of each line and can be offset by base address base_addr. num_per_line objects will be displayed on each line.

Parameters
[in]logThe log to dump the output to.
[in]offsetThe offset into the data at which to start dumping.
[in]lengthThe number of bytes to dump.
[in]base_addrThe base address that gets added to the offset displayed on each line.
[in]num_per_lineThe number of type objects to display on each line.
[in]typeThe type of objects to use when dumping data from this object. See DataExtractor::Type.
Returns
The offset at which dumping ended.

Definition at line 903 of file DataExtractor.cpp.

References lldb_private::StreamString::Clear(), lldb_private::StreamString::Empty(), GetAddress(), lldb_private::StreamString::GetSize(), GetSLEB128(), lldb_private::StreamString::GetString(), GetU16(), GetU32(), GetU64(), GetU8(), GetULEB128(), LLDB_INVALID_ADDRESS, lldb_private::Stream::Printf(), lldb_private::Log::PutString(), TypeChar, TypePointer, TypeSLEB128, TypeUInt16, TypeUInt32, TypeUInt64, TypeUInt8, TypeULEB128, and ValidOffset().

Referenced by lldb_private::IRExecutionUnit::DisassembleFunction(), lldb_private::IRExecutionUnit::GetRunnableInfo(), and lldb_private::IRExecutionUnit::WriteNow().

◆ SetAddressByteSize()

void lldb_private::DataExtractor::SetAddressByteSize ( uint32_t  addr_size)
inline

◆ SetByteOrder()

void lldb_private::DataExtractor::SetByteOrder ( lldb::ByteOrder  byte_order)
inline

Set the byte_order value.

Sets the byte order of the data to extract. Extracted values will be swapped if necessary when decoding.

Parameters
[in]byte_orderThe byte order value to use when extracting data.

Definition at line 929 of file DataExtractor.h.

References m_byte_order.

Referenced by lldb_private::ValueObject::CreateConstantValue(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GDBRemoteRegisterContext(), lldb_private::Opcode::GetData(), lldb_private::Scalar::GetData(), lldb_private::ValueObject::GetData(), ABISysV_arm::GetReturnValueObjectImpl(), lldb_private::Value::GetValueAsData(), LoadValueFromConsecutiveGPRRegisters(), lldb_private::ObjectFileJIT::ObjectFileJIT(), elf::ELFHeader::Parse(), ObjectFileCOFF::ParseHeader(), ObjectFilePECOFF::ParseHeader(), ObjectFileMachO::ParseHeader(), ObjectContainerUniversalMachO::ParseHeader(), ParseMachOHeader(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), lldb_private::wasm::ObjectFileWasm::ReadImageData(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::ObjectFileJIT::ReadSectionData(), lldb_private::ObjectFile::ReadSectionData(), lldb_private::ArchitectureAArch64::ReconfigureRegisterInfo(), RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(), RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(), RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(), RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(), lldb_private::CompactUnwindInfo::ScanIndex(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::ValueObjectDynamicValue::UpdateValue(), lldb_private::ValueObjectMemory::UpdateValue(), lldb_private::ValueObjectVariable::UpdateValue(), lldb_private::DWARFExpression::UpdateValue(), lldb_private::ValueObject::ValueObject(), and lldb_private::ValueObjectConstResult::ValueObjectConstResult().

◆ SetData() [1/3]

lldb::offset_t DataExtractor::SetData ( const DataExtractor data,
lldb::offset_t  offset,
lldb::offset_t  length 
)

Adopt a subset of data.

Set this object's data to be a subset of the data bytes in data. If data contains shared data, then a reference to the shared data will be added to ensure the shared data stays around as long as any objects have references to the shared data. The byte order and the address size settings are copied from data. If offset is not a valid offset in data, then no reference to the shared data will be added. If there are not length bytes available in data starting at offset, the length will be truncated to contains as many bytes as possible.

Parameters
[in]dataAnother DataExtractor object that contains data.
[in]offsetThe offset into data at which the subset starts.
[in]lengthThe length in bytes of the subset of data.
Returns
The number of bytes that this object now contains.

Definition at line 248 of file DataExtractor.cpp.

References GetByteOrder(), GetByteSize(), GetDataStart(), GetSharedDataOffset(), m_addr_size, m_byte_order, m_data_sp, SetData(), and ValidOffset().

◆ SetData() [2/3]

lldb::offset_t DataExtractor::SetData ( const lldb::DataBufferSP data_sp,
lldb::offset_t  offset = 0,
lldb::offset_t  length = LLDB_INVALID_OFFSET 
)

Adopt a subset of shared data in data_sp.

Copies the data shared pointer which adds a reference to the contained in data_sp. The shared data reference is reference counted to ensure the data lives as long as anyone still has a valid shared pointer to the data in data_sp. The byte order and address byte size settings remain the same. If offset is not a valid offset in data_sp, then no reference to the shared data will be added. If there are not length bytes available in data starting at offset, the length will be truncated to contains as many bytes as possible.

Parameters
[in]data_spA shared pointer to data.
[in]offsetThe offset into data_sp at which the subset starts.
[in]lengthThe length in bytes of the subset of data_sp.
Returns
The number of bytes that this object now contains.

Definition at line 281 of file DataExtractor.cpp.

References GetByteSize(), m_data_sp, m_end, and m_start.

◆ SetData() [3/3]

lldb::offset_t DataExtractor::SetData ( const void *  bytes,
lldb::offset_t  length,
lldb::ByteOrder  byte_order 
)

Set data with a buffer that is caller owned.

Use data that is owned by the caller when extracting values. The data must stay around as long as this object, or any object that copies a subset of this object's data, is valid. If bytes is nullptr, or length is zero, this object will contain no data.

Parameters
[in]bytesA pointer to caller owned data.
[in]lengthThe length in bytes of bytes.
[in]byte_orderA byte order of the data that we are extracting from.
Returns
The number of bytes that this object now contains.

Definition at line 224 of file DataExtractor.cpp.

References GetByteSize(), m_byte_order, m_data_sp, m_end, and m_start.

Referenced by Append(), ObjectFileELF::CalculateELFNotesSegmentsCRC32(), CommunicationKDP::CheckForPacket(), Copy(), ObjectContainerBSDArchive::CreateInstance(), lldb_private::ObjectContainerMachOFileset::CreateInstance(), ObjectContainerUniversalMachO::CreateInstance(), DataExtractor(), lldb_private::TypeFormatImpl_Format::FormatObject(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GDBRemoteRegisterContext(), ObjectFileELF::GetArchitecture(), lldb_private::Value::GetData(), lldb_private::Opcode::GetData(), lldb_private::RegisterValue::GetData(), lldb_private::Scalar::GetData(), lldb_private::ObjectFile::GetData(), ObjectContainerBSDArchive::GetModuleSpecifications(), lldb_private::ObjectContainerMachOFileset::GetModuleSpecifications(), ObjectContainerUniversalMachO::GetModuleSpecifications(), ObjectFileELF::GetModuleSpecifications(), ObjectFileMachO::GetModuleSpecifications(), lldb_private::ValueObject::GetPointeeData(), ObjectFileELF::GetProgramHeaderInfo(), ABISysV_arm::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ObjectFileELF::GetSectionHeaderInfo(), lldb_private::Value::GetValueAsData(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), LoadValueFromConsecutiveGPRRegisters(), lldb_private::ObjectContainerMachOFileset::MagicBytesMatch(), lldb_private::ObjectFileJSON::MagicBytesMatch(), ObjectFileMachO::MagicBytesMatch(), lldb_private::ObjectContainer::ObjectContainer(), lldb_private::ObjectFile::ObjectFile(), ObjectFileMachO::ParseHeader(), lldb_private::ObjectContainerMachOFileset::ParseHeader(), lldb_private::Type::ReadFromMemory(), lldb_private::wasm::ObjectFileWasm::ReadImageData(), ObjectFilePECOFF::ReadImageData(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::ObjectFileJIT::ReadSectionData(), ObjectFileELF::ReadSectionData(), lldb_private::ObjectFile::ReadSectionData(), lldb_private::ArchitectureAArch64::ReconfigureRegisterInfo(), RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(), RegisterContextCorePOSIX_arm64::RegisterContextCorePOSIX_arm64(), RegisterContextCorePOSIX_mips64::RegisterContextCorePOSIX_mips64(), RegisterContextCorePOSIX_powerpc::RegisterContextCorePOSIX_powerpc(), RegisterContextCorePOSIX_ppc64le::RegisterContextCorePOSIX_ppc64le(), RegisterContextCorePOSIX_s390x::RegisterContextCorePOSIX_s390x(), RegisterContextMemory::RegisterContextMemory(), lldb_private::CompactUnwindInfo::ScanIndex(), RegisterContextMemory::SetAllRegisterData(), SetData(), lldb_private::ValueObject::SetData(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::DWARFExpression::Update_DW_OP_addr(), lldb_private::AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded(), lldb_private::DWARFExpression::UpdateValue(), and lldb_private::ValueObjectConstResult::ValueObjectConstResult().

◆ Skip_LEB128()

uint32_t DataExtractor::Skip_LEB128 ( lldb::offset_t offset_ptr) const

Skip an LEB128 number at *offset_ptr.

Skips a LEB128 number (signed or unsigned) from this object's data starting at the offset pointed to by offset_ptr. The offset pointed to by offset_ptr will be updated with the offset of the byte following the last extracted byte.

Parameters
[in,out]offset_ptrA pointer to an offset within the data that will be advanced by the appropriate number of bytes if the value is extracted correctly. If the offset is out of bounds or there are not enough bytes to extract this value, the offset will be left unmodified.
Returns
The number of bytes consumed during the extraction.

Definition at line 877 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by GetOpcodeDataSize(), and lldb_private::plugin::dwarf::DWARFFormValue::SkipValue().

◆ ValidOffset()

bool lldb_private::DataExtractor::ValidOffset ( lldb::offset_t  offset) const
inline

◆ ValidOffsetForDataOfSize()

bool lldb_private::DataExtractor::ValidOffsetForDataOfSize ( lldb::offset_t  offset,
lldb::offset_t  length 
) const
inline

Member Data Documentation

◆ m_addr_size

uint32_t lldb_private::DataExtractor::m_addr_size
protected

The address size to use when extracting addresses.

Definition at line 1014 of file DataExtractor.h.

Referenced by Clear(), DataExtractor(), GetAddress(), GetAddress_unchecked(), GetAddressByteSize(), operator=(), SetAddressByteSize(), and SetData().

◆ m_byte_order

lldb::ByteOrder lldb_private::DataExtractor::m_byte_order
protected

◆ m_data_sp

lldb::DataBufferSP lldb_private::DataExtractor::m_data_sp
protected

The shared pointer to data that can be shared among multiple instances.

Definition at line 1016 of file DataExtractor.h.

Referenced by Clear(), Copy(), GetSharedDataBuffer(), GetSharedDataOffset(), operator=(), and SetData().

◆ m_end

const uint8_t* lldb_private::DataExtractor::m_end
protected
Initial value:
=
nullptr

A pointer to the byte that is past the end of the data.

Definition at line 1010 of file DataExtractor.h.

Referenced by Clear(), GetByteSize(), GetCStr(), GetDataEnd(), GetSLEB128(), GetULEB128(), operator=(), SetData(), and Skip_LEB128().

◆ m_start

const uint8_t* lldb_private::DataExtractor::m_start = nullptr
protected

◆ m_target_byte_size

uint32_t lldb_private::DataExtractor::m_target_byte_size = 1
protected

Making it const would require implementation of move assignment operator.

Definition at line 1018 of file DataExtractor.h.

Referenced by getTargetByteSize().


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