LLDB  mainline
Public Types | Public 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]
Collaboration diagram for lldb_private::DataExtractor:
Collaboration 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. More...
 
 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. More...
 
 DataExtractor (const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size=1)
 Construct with shared data. More...
 
 DataExtractor (const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size=1)
 Construct with a subset of data. More...
 
 DataExtractor (const DataExtractor &rhs)
 
const DataExtractoroperator= (const DataExtractor &rhs)
 Assignment operator. More...
 
virtual ~DataExtractor ()
 Destructor. More...
 
uint32_t getTargetByteSize () const
 
void Clear ()
 Clears the object state. More...
 
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 char *type_format=nullptr) 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. More...
 
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. More...
 
uint64_t GetAddress (lldb::offset_t *offset_ptr) const
 Extract an address from *offset_ptr. More...
 
uint64_t GetAddress_unchecked (lldb::offset_t *offset_ptr) const
 
uint32_t GetAddressByteSize () const
 Get the current address size. More...
 
uint64_t GetByteSize () const
 Get the number of bytes contained in this object. More...
 
const char * GetCStr (lldb::offset_t *offset_ptr) const
 Extract a C string from *offset_ptr. More...
 
const char * GetCStr (lldb::offset_t *offset_ptr, lldb::offset_t len) const
 Extract a C string from *offset_ptr with field size len. More...
 
const void * GetData (lldb::offset_t *offset_ptr, lldb::offset_t length) const
 Extract length bytes from *offset_ptr. More...
 
lldb::offset_t CopyData (lldb::offset_t offset, lldb::offset_t length, void *dst) const
 Copy length bytes from *offset, without swapping bytes. More...
 
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. More...
 
const uint8_t * GetDataEnd () const
 Get the data end pointer. More...
 
size_t GetSharedDataOffset () const
 Get the shared data offset. More...
 
const uint8_t * GetDataStart () const
 Get the data start pointer. More...
 
float GetFloat (lldb::offset_t *offset_ptr) const
 Extract a float from *offset_ptr. More...
 
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. More...
 
uint64_t GetMaxU64 (lldb::offset_t *offset_ptr, size_t byte_size) const
 Extract an unsigned integer of size byte_size from *offset_ptr. More...
 
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. More...
 
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. More...
 
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 byte_size from *offset_ptr, then extract and signe extend the bitfield from this value if bitfield_bit_size is non-zero. More...
 
uint64_t GetPointer (lldb::offset_t *offset_ptr) const
 Extract an pointer from *offset_ptr. More...
 
lldb::ByteOrder GetByteOrder () const
 Get the current byte order value. More...
 
uint8_t GetU8 (lldb::offset_t *offset_ptr) const
 Extract a uint8_t value from *offset_ptr. More...
 
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. More...
 
uint16_t GetU16 (lldb::offset_t *offset_ptr) const
 Extract a uint16_t value from *offset_ptr. More...
 
void * GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint16_t values from *offset_ptr. More...
 
uint32_t GetU32 (lldb::offset_t *offset_ptr) const
 Extract a uint32_t value from *offset_ptr. More...
 
void * GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint32_t values from *offset_ptr. More...
 
uint64_t GetU64 (lldb::offset_t *offset_ptr) const
 Extract a uint64_t value from *offset_ptr. More...
 
void * GetU64 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const
 Extract count uint64_t values from *offset_ptr. More...
 
int64_t GetSLEB128 (lldb::offset_t *offset_ptr) const
 Extract a signed LEB128 value from *offset_ptr. More...
 
uint64_t GetULEB128 (lldb::offset_t *offset_ptr) const
 Extract a unsigned LEB128 value from *offset_ptr. More...
 
lldb::DataBufferSP & GetSharedDataBuffer ()
 
const char * PeekCStr (lldb::offset_t offset) const
 Peek at a C string at offset. More...
 
const uint8_t * PeekData (lldb::offset_t offset, lldb::offset_t length) const
 Peek at a bytes at offset. More...
 
void SetAddressByteSize (uint32_t addr_size)
 Set the address byte size. More...
 
lldb::offset_t SetData (const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
 Set data with a buffer that is caller owned. More...
 
lldb::offset_t SetData (const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length)
 Adopt a subset of data. More...
 
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. More...
 
void SetByteOrder (lldb::ByteOrder byte_order)
 Set the byte_order value. More...
 
uint32_t Skip_LEB128 (lldb::offset_t *offset_ptr) const
 Skip an LEB128 number at *offset_ptr. More...
 
bool ValidOffset (lldb::offset_t offset) const
 Test the validity of offset. More...
 
bool ValidOffsetForDataOfSize (lldb::offset_t offset, lldb::offset_t length) const
 Test the availability of length bytes of data from offset. More...
 
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
 

Protected Attributes

const uint8_t * m_start
 A pointer to the first byte of data. More...
 
const uint8_t * m_end
 A pointer to the byte that is past the end of the data. More...
 
lldb::ByteOrder m_byte_order
 The byte order of the data we are extracting from. More...
 
uint32_t m_addr_size
 The address size to use when extracting pointers or addresses. More...
 
lldb::DataBufferSP m_data_sp
 The shared pointer to data that can be shared among multiple instances. More...
 
const uint32_t m_target_byte_size
 

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 47 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 51 of file DataExtractor.h.

Constructor & Destructor Documentation

◆ DataExtractor() [1/5]

DataExtractor::DataExtractor ( )

Default constructor.

Initialize all members to a default empty state.

Definition at line 122 of file DataExtractor.cpp.

Referenced by DataExtractor().

◆ DataExtractor() [2/5]

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.

References DataExtractor(), m_addr_size, m_byte_order, m_data_sp, m_end, m_start, m_target_byte_size, and SetData().

◆ DataExtractor() [3/5]

lldb_private::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

◆ DataExtractor() [4/5]

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 159 of file DataExtractor.cpp.

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

◆ DataExtractor() [5/5]

DataExtractor::DataExtractor ( const DataExtractor rhs)

Definition at line 173 of file DataExtractor.cpp.

References m_addr_size.

◆ ~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.

Referenced by operator=().

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

Definition at line 989 of file DataExtractor.h.

Referenced by InstructionLLVMC::Decode().

◆ Checksum()

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

Definition at line 1094 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 1027 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]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 714 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_x86_64::GetReturnValueObjectImpl(), ABISysV_ppc::GetReturnValueObjectImpl(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), lldb_private::ValueObject::SetData(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_ppc::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 702 of file DataExtractor.cpp.

References PeekData().

Referenced by lldb_private::ObjectFile::CopyData(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetIdentifierString(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), RegisterContextCorePOSIX_powerpc::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 683 of file DataExtractor.cpp.

References GetByteOrder(), and PeekData().

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

◆ 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 662 of file DataExtractor.cpp.

References GetMaxU64(), and m_addr_size.

Referenced by lldb_private::DWARFExpression::AddressRangeForLocationListEntry(), lldb_private::DWARFExpression::DumpLocation(), lldb_private::DWARFExpression::Evaluate(), ObjectFileELF::GetBaseAddress(), GetGNUEHPointer(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), lldb_private::DynamicLoaderDarwin::GetThreadLocalData(), EntityVariable::Materialize(), ObjectFileMachO::ProcessSegmentCommand(), and PutToLog().

◆ GetAddress_unchecked()

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

Definition at line 667 of file DataExtractor.cpp.

References GetMaxU64_unchecked(), and m_addr_size.

Referenced by GetClassDataMask(), and ObjectFileMachO::ParseSymtab().

◆ GetAddressByteSize()

uint32_t lldb_private::DataExtractor::GetAddressByteSize ( ) 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 607 of file DataExtractor.h.

Referenced by Append(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), lldb_private::DWARFExpression::CopyOpcodeData(), SymbolFileDWARFDwp::Create(), lldb_private::ValueObject::CreateConstantValue(), InstructionLLVMC::Decode(), EntityRegister::Dematerialize(), lldb_private::DumpDataExtractor(), ExtractBytes(), GetAPInt(), ObjectFileMachO::GetArchitecture(), ObjectFileJIT::GetByteOrder(), ObjectFileMachO::GetByteOrder(), lldb_private::Value::GetData(), lldb_private::ValueObject::GetData(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), ELFNote::Parse(), ELFLinuxPrPsInfo::Parse(), ObjectFileMachO::ParseSymtab(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), MappedHash::Header< Prologue >::Read(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), RegisterContextCorePOSIX_powerpc::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(), lldb_private::ValueObject::SetData(), SetData(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_ppc::SetReturnValueObject(), lldb_private::ValueObject::SetValueFromCString(), lldb_private::RegisterValue::SetValueFromData(), lldb_private::Scalar::SetValueFromData(), ToLLVM(), lldb_private::DWARFExpression::Update_DW_OP_addr(), 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 264 of file DataExtractor.h.

Referenced by Append(), calc_gnu_debuglink_crc32(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Checksum(), Copy(), SymbolFileDWARFDwp::Create(), lldb_private::ValueObjectConstResult::Create(), DataExtractor(), SymbolFileDWARF::DebugAbbrev(), SymbolFileDWARF::DebugLocData(), DisassemblerLLVMC::DecodeInstructions(), EntityVariable::Dematerialize(), EntityRegister::Dematerialize(), InstructionLLVMC::DoesBranch(), CommandObjectProcessKDPPacketSend::DoExecute(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), EmulateInstructionMIPS64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), lldb_private::TypeFormatImpl_EnumType::FormatObject(), lldb_private::Scalar::GetAsMemoryData(), ProcessElfCore::GetAuxvData(), ObjectFileELF::GetBaseAddress(), lldb_private::ValueObject::GetData(), lldb_private::DWARFExpression::GetDescription(), lldb_private::DWARFExpression::GetExpressionData(), lldb_private::ProcessStructReader::GetField(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), lldb_private::ObjectFile::GetLoadableData(), lldb_private::DWARFExpression::GetLocation(), SymbolFileDWARF::GetLocationListFormat(), ObjectFileELF::GetModuleSpecifications(), ABISysV_ppc::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_x86_64::GetReturnValueObjectImpl(), EmulateInstructionMIPS::GetSizeOfInstruction(), InstructionLLVMC::HasDelaySlot(), SymbolFileDWARF::InitializeObject(), InstructionLLVMC::IsCall(), lldb_private::CompactUnwindInfo::IsValid(), lldb_private::DWARFExpression::IsValid(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), LoadOrGetSection(), SymbolFileDWARFDwp::LoadSectionData(), EntityVariable::Materialize(), EntityRegister::Materialize(), ELFLinuxPrStatus::Parse(), ELFLinuxSigInfo::Parse(), ELFLinuxPrPsInfo::Parse(), ParseFreeBSDPrStatus(), ObjectContainerBSDArchive::ParseHeader(), ObjectFileMachO::ParseHeader(), ParseOpenBSDProcInfo(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::PrivateSetRegisterValue(), lldb_private::Type::ReadFromMemory(), lldb_private::CompilerType::ReadFromMemory(), lldb_private::ValueObject::ReadPointedString(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), ObjectFileJIT::ReadSectionData(), ObjectFileELF::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(), CommunicationKDP::SendRequestReadMemory(), CommunicationKDP::SendRequestReadRegisters(), SetData(), lldb_private::RegisterValue::SetValueFromData(), ToLLVM(), lldb_private::DWARFExpression::Update_DW_OP_addr(), CommunicationKDP::WaitForPacketWithTimeoutMicroSecondsNoLock(), 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 808 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), DWARFDebugInfoEntry::Extract(), DWARFFormValue::ExtractValue(), DWARFDebugInfoEntry::FastExtract(), ObjectFileELF::GetBaseAddress(), GetFreeBSDProcessArgs(), GetMacOSXProcessArgs(), GetNetBSDProcessArgs(), GetOpenBSDProcessArgs(), ELFNote::Parse(), DWARFDebugLine::ParsePrologue(), DWARFDebugLine::ParseStatementTable(), ParseTrieEntries(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), DWARFDebugMacroEntry::ReadMacroEntries(), and 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 839 of file DataExtractor.cpp.

References PeekData().

◆ GetData() [1/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 331 of file DataExtractor.h.

Referenced by lldb_private::DumpDataExtractor(), CommunicationKDP::DumpPacket(), ObjectContainerBSDArchive::Object::Extract(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), ABISysV_mips64::GetReturnValueObjectImpl(), ObjectFileMachO::GetSharedCacheUUID(), lldb_private::platform_android::AdbClient::GetSyncService(), MappedHash::MemoryTable< uint32_t, DWARFMappedHash::Header, DIEInfoArray >::MemoryTable(), lldb_private::breakpad::SymbolFileBreakpad::LineIterator::operator++(), DWARFASTParserClang::ParseChildMembers(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ObjectContainerBSDArchive::Archive::ParseObjects(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), CommunicationKDP::SendRequestReadMemory(), and CommunicationKDP::SendRequestReadRegisters().

◆ GetData() [2/2]

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

Definition at line 998 of file DataExtractor.h.

Referenced by GetDouble(), GetFloat(), GetMaxU64(), GetU16(), GetU32(), GetU64(), and GetU8().

◆ 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 401 of file DataExtractor.h.

◆ 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 417 of file DataExtractor.h.

References GetMaxS64(), and GetMaxU64().

Referenced by Append(), calc_gnu_debuglink_crc32(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), Checksum(), lldb_private::ValueObjectConstResult::Create(), EntityVariable::Dematerialize(), EntityRegister::Dematerialize(), InstructionLLVMC::DoesBranch(), CommandObjectProcessKDPPacketSend::DoExecute(), EmulateInstructionMIPS64::EvaluateInstruction(), EmulateInstructionMIPS::EvaluateInstruction(), lldb_private::ClangExpressionDeclMap::FindExternalVisibleDecls(), ProcessElfCore::GetAuxvData(), DWARFDebugInfoEntry::GetDIENamesAndRanges(), lldb_private::ObjectFile::GetLoadableData(), ObjectFileELF::GetModuleSpecifications(), EmulateInstructionMIPS::GetSizeOfInstruction(), ObjectFilePECOFF::GetSymtab(), lldb_private::ArmUnwindInfo::GetUnwindPlan(), InstructionLLVMC::HasDelaySlot(), InstructionLLVMC::IsCall(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), EntityVariable::Materialize(), EntityRegister::Materialize(), DWARFASTParserClang::ParseChildMembers(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadAllRegisterValues(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), ObjectFileELF::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::ValueObject::SetData(), SetData(), lldb_private::ValueObject::SetValueFromCString(), ToLLVM(), lldb_private::DWARFExpression::Update_DW_OP_addr(), and lldb_private::process_gdb_remote::GDBRemoteRegisterContext::WriteRegisterBytes().

◆ 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 607 of file DataExtractor.cpp.

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

Referenced by lldb_private::DumpDataExtractor(), ABISysV_mips::GetReturnValueObjectImpl(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_arm64::GetReturnValueObjectImpl(), ABIMacOSX_arm64::GetReturnValueObjectImpl(), ABISysV_s390x::GetReturnValueObjectSimple(), ABISysV_ppc::GetReturnValueObjectSimple(), ABISysV_x86_64::GetReturnValueObjectSimple(), ABISysV_i386::SetReturnValueObject(), lldb_private::RegisterValue::SetValueFromData(), and lldb_private::Scalar::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 565 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 byte_size from *offset_ptr, then extract and signe 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 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 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 588 of file DataExtractor.cpp.

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

Referenced by lldb_private::DumpDataExtractor(), and lldb_private::ClangASTContext::DumpTypeValue().

◆ 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 515 of file DataExtractor.cpp.

References GetMaxU64(), and lldbassert.

Referenced by 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 521 of file DataExtractor.cpp.

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

Referenced by DWARFFormValue::Address(), DWARFFormValue::AsCString(), DWARFDebugRanges::Dump(), lldb_private::DumpDataExtractor(), lldb_private::ClangASTContext::DumpSummary(), lldb_private::DWARFExpression::Evaluate(), InterpreterStackFrame::EvaluateValue(), DWARFDebugRanges::Extract(), DWARFDebugArangeSet::extract(), DWARFDebugRngLists::Extract(), DWARFDebugRngLists::ExtractRangeList(), DWARFFormValue::ExtractValue(), GetAddress(), GetAPInt(), lldb_private::DWARFDataExtractor::GetDWARFOffset(), lldb_private::ProcessStructReader::GetField(), GetMaxS64(), GetMaxU32(), GetMaxU64(), GetMaxU64Bitfield(), GetPointer(), lldb_private::CompilerType::GetValueAsScalar(), ELFLinuxPrPsInfo::Parse(), lldb_private::DWARFExpression::PrintDWARFLocationList(), ReadAddressFromDebugAddrSection(), lldb_private::EmulateInstruction::ReadMemoryUnsigned(), RegisterContextCorePOSIX_ppc64le::ReadRegister(), RegisterContextCorePOSIX_s390x::ReadRegister(), RegisterContextCorePOSIX_powerpc::ReadRegister(), RegisterContextCorePOSIX_arm64::ReadRegister(), RegisterContextCorePOSIX_arm::ReadRegister(), RegisterContextCorePOSIX_mips64::ReadRegister(), RegisterContextDarwin_arm64::ReadRegister(), lldb_private::Process::ReadScalarIntegerFromMemory(), ABIMacOSX_arm::SetReturnValueObject(), ABISysV_arm64::SetReturnValueObject(), ABISysV_s390x::SetReturnValueObject(), ABISysV_x86_64::SetReturnValueObject(), ABISysV_ppc64::SetReturnValueObject(), ABISysV_mips64::SetReturnValueObject(), ABISysV_ppc::SetReturnValueObject(), ABIMacOSX_arm64::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]byte_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 570 of file DataExtractor.cpp.

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

Referenced by lldb_private::DumpDataExtractor(), lldb_private::ClangASTContext::DumpTypeValue(), and lldb_private::ClangASTContext::DumpValue().

◆ GetPointer()

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

Extract an pointer from *offset_ptr.

Extract a single pointer from the data and update the offset pointed to by offset_ptr. The size of the extracted pointer comes from the m_addr_size member variable and should be set correctly prior to extracting any pointer 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 pointer value as a 64 integer.

Definition at line 678 of file DataExtractor.cpp.

References GetMaxU64(), and m_addr_size.

Referenced by CommunicationKDP::DumpPacket(), lldb_private::AppleObjCRuntime::GetBacktraceThreadFromException(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), lldb_private::ValueObject::GetPointerValue(), lldb_private::AppleObjCRuntimeV2::GetTaggedPointerObfuscator(), GetVTableAddress(), lldb_private::AppleObjCRuntimeV2::LookupRuntimeSymbol(), ELFLinuxPrStatus::Parse(), ELFLinuxPrPsInfo::Parse(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DynamicLoaderMacOSXDYLD::ReadImageInfos(), lldb_private::ValueObjectDynamicValue::SetData(), and lldb_private::AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler().

◆ GetSharedDataBuffer()

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

Definition at line 820 of file DataExtractor.h.

Referenced by ParsePLTRelocations(), and RegisterContextMemory::ReadRegister().

◆ 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 206 of file DataExtractor.cpp.

References 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 900 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by lldb_private::DWARFExpression::DumpLocation(), lldb_private::DWARFExpression::Evaluate(), DWARFFormValue::ExtractValue(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), GetGNUEHPointer(), lldb_private::DWARFExpression::MatchesOperand(), DWARFDebugLine::ParseStatementTable(), print_dwarf_exp_op(), and PutToLog().

◆ getTargetByteSize()

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

Definition at line 158 of file DataExtractor.h.

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 350 of file DataExtractor.cpp.

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

Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), InstructionLLVMC::Decode(), lldb_private::DumpDataExtractor(), lldb_private::DWARFExpression::DumpLocation(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), DWARFCompileUnit::extract(), DWARFDebugArangeSet::extract(), DWARFDebugRngLists::Extract(), DWARFDebugInfoEntry::Extract(), DWARFFormValue::ExtractValue(), lldb_private::DWARFExpression::GetDescription(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), GetGNUEHPointer(), lldb_private::DWARFExpression::GetLocation(), GetMaxU64(), ObjectFilePECOFF::GetSymtab(), lldb_private::CompactUnwindInfo::IsValid(), lldb_private::DWARFExpression::LocationListContainsAddress(), lldb_private::DWARFExpression::LocationListSize(), ObjectFilePECOFF::MagicBytesMatch(), ELFLinuxPrStatus::Parse(), elf::ELFHeader::Parse(), elf::ELFSymbol::Parse(), ObjectFilePECOFF::ParseCOFFHeader(), ObjectFilePECOFF::ParseDOSHeader(), DWARFDebugMacroHeader::ParseHeader(), DWARFDebugLine::ParsePrologue(), DWARFDebugLine::ParseStatementTable(), print_dwarf_exp_op(), lldb_private::DWARFExpression::PrintDWARFLocationList(), PutToLog(), DWARFMappedHash::Prologue::Read(), MappedHash::Header< Prologue >::Read(), SetDwoStrOffsetsBase(), lldb_private::Scalar::SetValueFromData(), and 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 398 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::DWARFExpression::AddressRangeForLocationListEntry(), DWARFMappedHash::MemoryTable::AppendAllDIEsInRange(), DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(), lldb_private::ArmUnwindInfo::ArmUnwindInfo(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), ObjectFileMachO::CreateSections(), InstructionLLVMC::Decode(), DynamicLoaderMacOSXDYLD::DoInitialImageFetch(), lldb_private::DumpDataExtractor(), lldb_private::DWARFExpression::DumpLocation(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), DWARFDebugRngLists::Extract(), DWARFDebugInfoEntry::Extract(), DWARFFormValue::ExtractValue(), DWARFDebugInfoEntry::FastExtract(), ObjectFileMachO::GetArchitecture(), ObjectFileELF::GetBaseAddress(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetDependentModules(), lldb_private::DWARFDataExtractor::GetDWARFInitialLength(), ObjectFileMachO::GetEncryptedFileRanges(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), GetGNUEHPointer(), DWARFMappedHash::MemoryTable::GetHashDataForName(), ObjectFileMachO::GetIdentifierString(), GetMacOSXProcessArgs(), GetMaxU64(), ObjectFileMachO::GetMinimumOSVersion(), ObjectFileMachO::GetNumThreadContexts(), ObjectFileMachO::GetSDKVersion(), ObjectFilePECOFF::GetSymtab(), lldb_private::platform_android::AdbClient::GetSyncService(), lldb_private::AppleObjCRuntimeV2::GetTaggedPointerObfuscator(), ObjectFileMachO::GetUUID(), lldb_private::CompilerType::GetValueAsScalar(), ObjectFileMachO::GetVersion(), ObjectFileMachO::IsStripped(), lldb_private::CompactUnwindInfo::IsValid(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), ObjectContainerUniversalMachO::MagicBytesMatch(), ObjectFileMachO::MagicBytesMatch(), ELFNote::Parse(), ELFLinuxPrStatus::Parse(), ELFLinuxSigInfo::Parse(), ELFLinuxPrPsInfo::Parse(), elf::ELFHeader::Parse(), elf::ELFSectionHeader::Parse(), elf::ELFProgramHeader::Parse(), elf::ELFSymbol::Parse(), ObjectFilePECOFF::ParseCOFFHeader(), ObjectFilePECOFF::ParseDOSHeader(), ParseFreeBSDPrStatus(), DWARFDebugMacroHeader::ParseHeader(), ObjectContainerUniversalMachO::ParseHeader(), ObjectFileMachO::ParseHeader(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ParseNetBSDProcInfo(), ParseOpenBSDProcInfo(), DWARFDebugLine::ParseStatementTable(), ObjectFileMachO::ParseSymtab(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), print_dwarf_exp_op(), ObjectFileMachO::ProcessDysymtabCommand(), ObjectFileMachO::ProcessSegmentCommand(), PutToLog(), DWARFMappedHash::Prologue::Read(), MappedHash::Header< Prologue >::Read(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DWARFMappedHash::MemoryTable::ReadHashData(), DynamicLoaderDarwinKernel::ReadKextSummaryHeader(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), DWARFDebugMacroEntry::ReadMacroEntries(), lldb_private::minidump::RegisterContextMinidump_ARM::RegisterContextMinidump_ARM(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), CommunicationKDP::SendRawRequest(), CommunicationKDP::SendRequestBreakpoint(), CommunicationKDP::SendRequestHostInfo(), CommunicationKDP::SendRequestReadMemory(), CommunicationKDP::SendRequestReadRegisters(), CommunicationKDP::SendRequestReattach(), CommunicationKDP::SendRequestVersion(), CommunicationKDP::SendRequestWriteMemory(), CommunicationKDP::SendRequestWriteRegisters(), 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::Scalar::SetValueFromData(), DWARFFormValue::SkipValue(), and lldb_private::platform_android::AdbClient::SyncService::~SyncService().

◆ 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 445 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 473 of file DataExtractor.cpp.

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

Referenced by InstructionLLVMC::CalculateMnemonicOperandsAndComment(), InstructionLLVMC::Decode(), lldb_private::DWARFExpression::DumpLocation(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), DWARFCompileUnit::extract(), DWARFFormValue::ExtractValue(), GetAPInt(), ObjectFileMachO::GetCorefileMainBinaryInfo(), ObjectFileMachO::GetEntryPointAddress(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), GetGNUEHPointer(), GetMaxU64(), ABISysV_mips64::GetReturnValueObjectImpl(), lldb_private::CompilerType::GetValueAsScalar(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), elf::ELFSymbol::Parse(), DWARFDebugMacroHeader::ParseHeader(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), DWARFDebugLine::ParseStatementTable(), ObjectFileMachO::ParseSymtab(), SystemRuntimeMacOSX::PopulateQueuesUsingLibBTR(), print_dwarf_exp_op(), PutToLog(), DWARFDebugMacroEntry::ReadMacroEntries(), ReadUIntMax64(), lldb_private::minidump::RegisterContextMinidump_ARM::RegisterContextMinidump_ARM(), lldb_private::minidump::RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(), DynamicLoaderDarwinKernel::SearchForKernelWithDebugHints(), SetDwoStrOffsetsBase(), RegisterContextDarwin_x86_64_Mach::SetRegisterDataFrom_LC_THREAD(), RegisterContextDarwin_arm64_Mach::SetRegisterDataFrom_LC_THREAD(), lldb_private::RegisterValue::SetValueFromData(), and lldb_private::Scalar::SetValueFromData().

◆ 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 491 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 320 of file DataExtractor.cpp.

References GetData().

Referenced by lldb_private::DWARFExpression::AddressRangeForLocationListEntry(), InstructionLLVMC::CalculateMnemonicOperandsAndComment(), CommunicationKDP::CheckForPacket(), lldb_private::DWARFExpression::ContainsThreadLocalStorage(), InstructionLLVMC::Decode(), lldb_private::DumpDataExtractor(), lldb_private::DWARFExpression::DumpLocation(), CommunicationKDP::DumpPacket(), lldb_private::DWARFExpression::Evaluate(), DWARFCompileUnit::extract(), DWARFDebugArangeSet::extract(), DWARFAbbreviationDeclaration::extract(), DWARFDebugRngLists::Extract(), DWARFDebugInfoEntry::Extract(), DWARFDebugRngLists::ExtractRangeList(), DWARFFormValue::ExtractValue(), ObjectFileELF::GetBaseAddress(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), GetMaxU64(), ObjectFilePECOFF::GetSymtab(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), lldb_private::DWARFExpression::MatchesOperand(), ELFLinuxPrPsInfo::Parse(), elf::ELFHeader::Parse(), DWARFDebugLine::Parse(), elf::ELFSymbol::Parse(), DWARFDebugMacroHeader::ParseHeader(), DWARFDebugLine::ParsePrologue(), DWARFDebugLine::ParseStatementTable(), ParseTrieEntries(), print_dwarf_exp_op(), ObjectFileMachO::ProcessSegmentCommand(), PutToLog(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DWARFDebugMacroEntry::ReadMacroEntries(), CommunicationKDP::SendRequestAndGetReply(), ThreadKDP::SetStopInfoFrom_KDP_EXCEPTION(), lldb_private::Scalar::SetValueFromData(), 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 333 of file DataExtractor.cpp.

References GetData().

◆ GetU8_unchecked()

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

◆ 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 867 of file DataExtractor.cpp.

References m_end, m_start, and PeekData().

Referenced by lldb_private::DWARFExpression::AddressRangeForLocationListEntry(), DWARFDebugInfoEntry::Dump(), lldb_private::DWARFExpression::DumpLocation(), lldb_private::DWARFExpression::Evaluate(), DWARFAbbreviationDeclaration::extract(), DWARFDebugInfoEntry::Extract(), DWARFDebugRngLists::ExtractRangeList(), DWARFFormValue::ExtractValue(), DWARFDebugInfoEntry::FastExtract(), DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(), ObjectFileELF::GetBaseAddress(), lldb_private::DWARFCallFrameInfo::GetFunctionAddressAndSizeVector(), GetGNUEHPointer(), lldb_private::DWARFExpression::GetLocation_DW_OP_addr(), lldb_private::DWARFExpression::MatchesOperand(), DWARFDebugLine::Parse(), DWARFDebugMacroHeader::ParseHeader(), DWARFDebugLine::ParsePrologue(), DWARFDebugLine::ParseStatementTable(), ParseTrieEntries(), print_dwarf_exp_op(), PutToLog(), DWARFDebugMacroEntry::ReadMacroEntries(), and DWARFFormValue::SkipValue().

◆ operator=()

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 181 of file DataExtractor.cpp.

References m_addr_size, m_byte_order, m_data_sp, m_end, m_start, and ~DataExtractor().

◆ 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 857 of file DataExtractor.cpp.

References PeekData().

Referenced by DWARFMappedHash::MemoryTable::AppendHashDataForRegularExpression(), DWARFFormValue::AsCString(), SymbolFileDWARFDwp::Create(), elf::ELFSymbol::Dump(), CommunicationKDP::DumpPacket(), ObjectFileELF::GetBaseAddress(), ObjectFileMachO::GetDependentModules(), DWARFMappedHash::MemoryTable::GetHashDataForName(), DWARFMappedHash::MemoryTable::GetStringForKeyType(), ObjectFilePECOFF::GetSymtab(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ParsePLTRelocations(), 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 char *  type_format = nullptr 
) 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]sThe stream to dump the output to. If nullptr the output will be dumped to Log().
[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.
[in]type_formatThe optional format to use for the type objects. If this is nullptr, the default format for the type will be used.
Returns
The offset at which dumping ended.

Definition at line 966 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(), isprint(), 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::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 944 of file DataExtractor.h.

Referenced by AuxVector::AuxVector(), lldb_private::DWARFExpression::CopyOpcodeData(), lldb_private::ValueObject::CreateConstantValue(), lldb_private::Type::DumpValueInMemory(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GDBRemoteRegisterContext(), lldb_private::Opcode::GetData(), lldb_private::ValueObject::GetData(), ABISysV_arm::GetReturnValueObjectImpl(), lldb_private::Value::GetValueAsData(), lldb_private::CompactUnwindInfo::IsValid(), LoadValueFromConsecutiveGPRRegisters(), ObjectFileJIT::ObjectFileJIT(), elf::ELFHeader::Parse(), ObjectContainerUniversalMachO::ParseHeader(), ObjectFileMachO::ParseHeader(), MappedHash::Header< Prologue >::Read(), DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), 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::ValueObject::SetValueFromCString(), and lldb_private::ValueObjectVariable::UpdateValue().

◆ SetData() [1/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 227 of file DataExtractor.cpp.

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

Referenced by Append(), AuxVector::AuxVector(), calc_gnu_debuglink_crc32(), CommunicationKDP::CheckForPacket(), Copy(), lldb_private::DWARFExpression::CopyOpcodeData(), ObjectContainerUniversalMachO::CreateInstance(), ObjectContainerBSDArchive::CreateInstance(), DataExtractor(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::GDBRemoteRegisterContext(), ObjectFileELF::GetArchitecture(), ObjectFileELF::GetBaseAddress(), lldb_private::RegisterValue::GetData(), lldb_private::Scalar::GetData(), lldb_private::Opcode::GetData(), lldb_private::Value::GetData(), lldb_private::ObjectFile::GetData(), ObjectContainerUniversalMachO::GetModuleSpecifications(), ObjectContainerBSDArchive::GetModuleSpecifications(), ObjectFileMachO::GetModuleSpecifications(), ObjectFileELF::GetModuleSpecifications(), lldb_private::ValueObject::GetPointeeData(), ABISysV_mips64::GetReturnValueObjectImpl(), ABISysV_arm::GetReturnValueObjectImpl(), lldb_private::Value::GetValueAsData(), lldb_private::CompactUnwindInfo::IsValid(), lldb_private::DWARFExpression::LinkThreadLocalStorage(), SymbolFileDWARFDwp::LoadSectionData(), LoadValueFromConsecutiveGPRRegisters(), ObjectFileMachO::MagicBytesMatch(), lldb_private::ObjectContainer::ObjectContainer(), lldb_private::ObjectFile::ObjectFile(), ObjectFileMachO::ParseHeader(), lldb_private::Type::ReadFromMemory(), lldb_private::CompilerType::ReadFromMemory(), DynamicLoaderMacOSXDYLD::ReadMachHeader(), lldb_private::process_gdb_remote::GDBRemoteRegisterContext::ReadRegisterBytes(), ObjectFileJIT::ReadSectionData(), ObjectFileELF::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(), RegisterContextMemory::RegisterContextMemory(), RegisterContextMemory::SetAllRegisterData(), lldb_private::ValueObject::SetData(), SetData(), lldb_private::DWARFExpression::SetOpcodeData(), lldb_private::ValueObject::SetValueFromCString(), and lldb_private::DWARFExpression::Update_DW_OP_addr().

◆ SetData() [2/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 251 of file DataExtractor.cpp.

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

◆ SetData() [3/3]

lldb::offset_t lldb_private::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.

◆ 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

Definition at line 940 of file DataExtractor.cpp.

References m_end, and PeekData().

Referenced by DWARFDebugInfoEntry::Extract(), DWARFDebugInfoEntry::FastExtract(), GetOpcodeDataSize(), DWARFDebugLine::ParseStatementTable(), and 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 pointers or addresses.

Definition at line 1009 of file DataExtractor.h.

Referenced by Clear(), DataExtractor(), GetAddress(), GetAddress_unchecked(), GetPointer(), operator=(), 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
mutableprotected

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

Definition at line 1011 of file DataExtractor.h.

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

◆ m_end

const uint8_t* lldb_private::DataExtractor::m_end
protected

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

Definition at line 1006 of file DataExtractor.h.

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

◆ m_start

const uint8_t* lldb_private::DataExtractor::m_start
protected

◆ m_target_byte_size

const uint32_t lldb_private::DataExtractor::m_target_byte_size
protected

Definition at line 1013 of file DataExtractor.h.

Referenced by DataExtractor().


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