|
LLVM
3.7.0
|
#include <DataExtractor.h>
Public Member Functions | |
| DataExtractor (StringRef Data, bool IsLittleEndian, uint8_t AddressSize) | |
| Construct with a buffer that is owned by the caller. More... | |
| StringRef | getData () const |
| Get the data pointed to by this extractor. More... | |
| bool | isLittleEndian () const |
| Get the endianess for this extractor. More... | |
| uint8_t | getAddressSize () const |
| Get the address size for this extractor. More... | |
| void | setAddressSize (uint8_t Size) |
| Set the address size for this extractor. More... | |
| const char * | getCStr (uint32_t *offset_ptr) const |
| Extract a C string from *offset_ptr. More... | |
| uint64_t | getUnsigned (uint32_t *offset_ptr, uint32_t byte_size) const |
| Extract an unsigned integer of size byte_size from *offset_ptr. More... | |
| int64_t | getSigned (uint32_t *offset_ptr, uint32_t size) const |
| Extract an signed integer of size byte_size from *offset_ptr. More... | |
| uint64_t | getAddress (uint32_t *offset_ptr) const |
| Extract an pointer from *offset_ptr. More... | |
| uint8_t | getU8 (uint32_t *offset_ptr) const |
| Extract a uint8_t value from *offset_ptr. More... | |
| uint8_t * | getU8 (uint32_t *offset_ptr, uint8_t *dst, uint32_t count) const |
| Extract count uint8_t values from *offset_ptr. More... | |
| uint16_t | getU16 (uint32_t *offset_ptr) const |
| Extract a uint16_t value from *offset_ptr. More... | |
| uint16_t * | getU16 (uint32_t *offset_ptr, uint16_t *dst, uint32_t count) const |
| Extract count uint16_t values from *offset_ptr. More... | |
| uint32_t | getU32 (uint32_t *offset_ptr) const |
| Extract a uint32_t value from *offset_ptr. More... | |
| uint32_t * | getU32 (uint32_t *offset_ptr, uint32_t *dst, uint32_t count) const |
| Extract count uint32_t values from *offset_ptr. More... | |
| uint64_t | getU64 (uint32_t *offset_ptr) const |
| Extract a uint64_t value from *offset_ptr. More... | |
| uint64_t * | getU64 (uint32_t *offset_ptr, uint64_t *dst, uint32_t count) const |
| Extract count uint64_t values from *offset_ptr. More... | |
| int64_t | getSLEB128 (uint32_t *offset_ptr) const |
| Extract a signed LEB128 value from *offset_ptr. More... | |
| uint64_t | getULEB128 (uint32_t *offset_ptr) const |
| Extract a unsigned LEB128 value from *offset_ptr. More... | |
| bool | isValidOffset (uint32_t offset) const |
| Test the validity of offset. More... | |
| bool | isValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const |
| Test the availability of length bytes of data from offset. More... | |
| bool | isValidOffsetForAddress (uint32_t offset) const |
| Test the availability of enough bytes of data for a pointer from offset. More... | |
Definition at line 17 of file DataExtractor.h.
|
inline |
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.
Definition at line 27 of file DataExtractor.h.
|
inline |
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 is getAddressSize(), so the address size has to be set correctly prior to extracting any pointer values.
| [in,out] | offset_ptr | A 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. |
Definition at line 129 of file DataExtractor.h.
References getUnsigned().
Referenced by llvm::DWARFDebugRangeList::extract(), llvm::DWARFUnit::getAddrOffsetSectionItem(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLine::LineTable::parse(), and llvm::FrameEntry::parseInstructions().
|
inline |
Get the address size for this extractor.
Definition at line 35 of file DataExtractor.h.
Referenced by llvm::DWARFDebugRangeList::extract(), and llvm::DWARFDebugFrame::parse().
| const char * DataExtractor::getCStr | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 121 of file DataExtractor.cpp.
References llvm::StringRef::data(), llvm::StringRef::find(), and llvm::StringRef::npos.
Referenced by llvm::DWARFAcceleratorTable::dump(), llvm::DWARFContext::dump(), dumpPubSection(), llvm::DWARFFormValue::extractValue(), llvm::DWARFFormValue::getAsCString(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLine::Prologue::parse(), llvm::DWARFDebugLine::LineTable::parse(), and llvm::DWARFFormValue::skipValue().
|
inline |
Get the data pointed to by this extractor.
Definition at line 31 of file DataExtractor.h.
Referenced by llvm::DWARFFormValue::extractValue(), llvm::DWARFDebugLoc::parse(), and llvm::DWARFDebugLocDWO::parse().
| int64_t DataExtractor::getSigned | ( | uint32_t * | offset_ptr, |
| uint32_t | 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 should have a value greater than or equal to one and less than or equal to eight since the return value is 64 bits wide. Any byte_size values less than 1 or greater than 8 will result in nothing being extracted, and zero being returned.
| [in,out] | offset_ptr | A 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] | size | The size in bytes of the integer to extract. |
Definition at line 107 of file DataExtractor.cpp.
References getU16(), getU32(), getU64(), getU8(), and llvm_unreachable.
| int64_t DataExtractor::getSLEB128 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 152 of file DataExtractor.cpp.
References llvm::StringRef::empty(), and isValidOffset().
Referenced by llvm::DWARFFormValue::extractValue(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLine::LineTable::parse(), and llvm::FrameEntry::parseInstructions().
| uint16_t DataExtractor::getU16 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 61 of file DataExtractor.cpp.
References llvm::StringRef::data().
Referenced by dumpPubSection(), llvm::DWARFAcceleratorTable::extract(), llvm::DWARFDebugArangeSet::extract(), llvm::DWARFUnit::extractImpl(), llvm::DWARFFormValue::extractValue(), getSigned(), getUnsigned(), llvm::DWARFDebugLoc::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::DWARFDebugLine::Prologue::parse(), llvm::DWARFDebugLine::LineTable::parse(), llvm::FrameEntry::parseInstructions(), and llvm::DWARFFormValue::skipValue().
| uint16_t * DataExtractor::getU16 | ( | uint32_t * | offset_ptr, |
| uint16_t * | 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.
| [in,out] | offset_ptr | A 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] | dst | A buffer to copy count uint16_t values into. dst must be large enough to hold all requested data. |
| [in] | count | The number of uint16_t values to extract. |
Definition at line 65 of file DataExtractor.cpp.
References llvm::StringRef::data().
| uint32_t DataExtractor::getU32 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 71 of file DataExtractor.cpp.
References llvm::StringRef::data().
Referenced by llvm::DWARFAcceleratorTable::dump(), llvm::DWARFContext::dump(), dumpPubSection(), llvm::DWARFAcceleratorTable::extract(), llvm::DWARFDebugArangeSet::extract(), llvm::DWARFTypeUnit::extractImpl(), llvm::DWARFUnit::extractImpl(), llvm::DWARFFormValue::extractValue(), getSigned(), llvm::DWARFUnit::getStringOffsetSectionItem(), getUnsigned(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::DWARFDebugLine::Prologue::parse(), llvm::FrameEntry::parseInstructions(), and llvm::DWARFFormValue::skipValue().
| uint32_t * DataExtractor::getU32 | ( | uint32_t * | offset_ptr, |
| uint32_t * | 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.
| [in,out] | offset_ptr | A 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] | dst | A buffer to copy count uint32_t values into. dst must be large enough to hold all requested data. |
| [in] | count | The number of uint32_t values to extract. |
Definition at line 75 of file DataExtractor.cpp.
References llvm::StringRef::data().
| uint64_t DataExtractor::getU64 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 81 of file DataExtractor.cpp.
References llvm::StringRef::data().
Referenced by consumeCompressedDebugSectionHeader(), llvm::DWARFTypeUnit::extractImpl(), llvm::DWARFFormValue::extractValue(), getSigned(), getUnsigned(), llvm::DWARFDebugFrame::parse(), and llvm::DWARFDebugLine::Prologue::parse().
| uint64_t * DataExtractor::getU64 | ( | uint32_t * | offset_ptr, |
| uint64_t * | 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.
| [in,out] | offset_ptr | A 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] | dst | A buffer to copy count uint64_t values into. dst must be large enough to hold all requested data. |
| [in] | count | The number of uint64_t values to extract. |
Definition at line 85 of file DataExtractor.cpp.
References llvm::StringRef::data().
| uint8_t DataExtractor::getU8 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 50 of file DataExtractor.cpp.
References llvm::StringRef::data().
Referenced by dumpDataAux(), dumpPubSection(), llvm::DWARFAbbreviationDeclaration::extract(), llvm::DWARFDebugArangeSet::extract(), llvm::DWARFUnit::extractImpl(), llvm::DWARFFormValue::extractValue(), getSigned(), getUnsigned(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::DWARFDebugLine::Prologue::parse(), llvm::DWARFDebugLine::LineTable::parse(), llvm::FrameEntry::parseInstructions(), and llvm::DWARFFormValue::skipValue().
| uint8_t * DataExtractor::getU8 | ( | uint32_t * | offset_ptr, |
| uint8_t * | 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.
| [in,out] | offset_ptr | A 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] | dst | A buffer to copy count uint8_t values into. dst must be large enough to hold all requested data. |
| [in] | count | The number of uint8_t values to extract. |
Definition at line 55 of file DataExtractor.cpp.
References llvm::StringRef::data().
| uint64_t DataExtractor::getULEB128 | ( | uint32_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.
| [in,out] | offset_ptr | A 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. |
Definition at line 131 of file DataExtractor.cpp.
References llvm::StringRef::empty(), and isValidOffset().
Referenced by llvm::DWARFDebugInfoEntryMinimal::dump(), llvm::DWARFAbbreviationDeclaration::extract(), llvm::DWARFDebugInfoEntryMinimal::extractFast(), llvm::DWARFFormValue::extractValue(), llvm::DWARFDebugInfoEntryMinimal::getAttributeValue(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLocDWO::parse(), llvm::DWARFDebugLine::Prologue::parse(), llvm::DWARFDebugLine::LineTable::parse(), llvm::FrameEntry::parseInstructions(), llvm::object::MachOObjectFile::ReadULEB128s(), and llvm::DWARFFormValue::skipValue().
| uint64_t DataExtractor::getUnsigned | ( | uint32_t * | offset_ptr, |
| uint32_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 should have a value greater than or equal to one and less than or equal to eight since the return value is 64 bits wide. Any byte_size values less than 1 or greater than 8 will result in nothing being extracted, and zero being returned.
| [in,out] | offset_ptr | A 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_size | The size in byte of the integer to extract. |
Definition at line 92 of file DataExtractor.cpp.
References getU16(), getU32(), getU64(), getU8(), and llvm_unreachable.
Referenced by llvm::DWARFDebugArangeSet::extract(), llvm::DWARFFormValue::extractValue(), getAddress(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLoc::parse(), and llvm::DWARFDebugLine::Prologue::parse().
|
inline |
Get the endianess for this extractor.
Definition at line 33 of file DataExtractor.h.
|
inline |
Test the validity of offset.
Definition at line 340 of file DataExtractor.h.
References llvm::StringRef::size().
Referenced by llvm::DWARFDebugInfoEntryMinimal::dump(), llvm::DWARFAcceleratorTable::dump(), dumpPubSection(), llvm::DWARFAcceleratorTable::extract(), llvm::DWARFDebugAbbrev::extract(), llvm::DWARFDebugArangeSet::extract(), llvm::DWARFDebugRangeList::extract(), llvm::DWARFUnit::extract(), llvm::DWARFDebugInfoEntryMinimal::extractFast(), llvm::DWARFUnit::extractImpl(), getSLEB128(), getULEB128(), isValidOffsetForDataOfSize(), llvm::DWARFDebugFrame::parse(), llvm::DWARFDebugLoc::parse(), and llvm::DWARFDebugLocDWO::parse().
|
inline |
Test the availability of enough bytes of data for a pointer from offset.
The size of a pointer is getAddressSize().
Definition at line 358 of file DataExtractor.h.
References isValidOffsetForDataOfSize().
|
inline |
Test the availability of length bytes of data from offset.
Definition at line 347 of file DataExtractor.h.
References isValidOffset().
Referenced by llvm::DWARFAcceleratorTable::dump(), llvm::DWARFDebugArangeSet::extract(), getU(), getUs(), and isValidOffsetForAddress().
|
inline |
Set the address size for this extractor.
Definition at line 37 of file DataExtractor.h.
Referenced by llvm::DWARFDebugFrame::parse().
1.8.6