LLVM
8.0.1
|
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for that section, if there is one. More...
#include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
Public Member Functions | |
DWARFDataExtractor (const DWARFObject &Obj, const DWARFSection &Section, bool IsLittleEndian, uint8_t AddressSize) | |
Constructor for the normal case of extracting data from a DWARF section. More... | |
DWARFDataExtractor (StringRef Data, bool IsLittleEndian, uint8_t AddressSize) | |
Constructor for cases when there are no relocations. More... | |
uint64_t | getRelocatedValue (uint32_t Size, uint32_t *Off, uint64_t *SectionIndex=nullptr) const |
Extracts a value and applies a relocation to the result if one exists for the given offset. More... | |
uint64_t | getRelocatedAddress (uint32_t *Off, uint64_t *SecIx=nullptr) const |
Extracts an address-sized value and applies a relocation to the result if one exists for the given offset. More... | |
Optional< uint64_t > | getEncodedPointer (uint32_t *Offset, uint8_t Encoding, uint64_t AbsPosOffset=0) const |
Extracts a DWARF-encoded pointer in Offset using Encoding . More... | |
size_t | size () const |
Public Member Functions inherited from llvm::DataExtractor | |
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 endianness 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... | |
StringRef | getCStrRef (uint32_t *OffsetPtr) const |
Extract a C string from *OffsetPtr. 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 | getU24 (uint32_t *offset_ptr) const |
Extract a 24-bit unsigned value from *offset_ptr and return it in a uint32_t. 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... | |
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for that section, if there is one.
Definition at line 21 of file DWARFDataExtractor.h.
|
inline |
Constructor for the normal case of extracting data from a DWARF section.
The DWARFSection's lifetime must be at least as long as the extractor's.
Definition at line 28 of file DWARFDataExtractor.h.
References llvm::Data.
|
inline |
Constructor for cases when there are no relocations.
Definition at line 34 of file DWARFDataExtractor.h.
References getRelocatedValue(), and Size.
Optional< uint64_t > DWARFDataExtractor::getEncodedPointer | ( | uint32_t * | Offset, |
uint8_t | Encoding, | ||
uint64_t | AbsPosOffset = 0 |
||
) | const |
Extracts a DWARF-encoded pointer in Offset
using Encoding
.
There is a DWARF encoding that uses a PC-relative adjustment. For these values, AbsPosOffset
is used to fix them, which should reflect the absolute address of this pointer.
Definition at line 31 of file DWARFDataExtractor.cpp.
References llvm::dwarf::DW_EH_PE_absptr, llvm::dwarf::DW_EH_PE_aligned, llvm::dwarf::DW_EH_PE_datarel, llvm::dwarf::DW_EH_PE_funcrel, llvm::dwarf::DW_EH_PE_omit, llvm::dwarf::DW_EH_PE_pcrel, llvm::dwarf::DW_EH_PE_sdata2, llvm::dwarf::DW_EH_PE_sdata4, llvm::dwarf::DW_EH_PE_sdata8, llvm::dwarf::DW_EH_PE_sleb128, llvm::dwarf::DW_EH_PE_textrel, llvm::dwarf::DW_EH_PE_udata2, llvm::dwarf::DW_EH_PE_udata4, llvm::dwarf::DW_EH_PE_udata8, llvm::dwarf::DW_EH_PE_uleb128, llvm::DataExtractor::getAddressSize(), llvm::DataExtractor::getSigned(), llvm::DataExtractor::getSLEB128(), llvm::DataExtractor::getULEB128(), llvm::DataExtractor::getUnsigned(), and llvm::None.
Referenced by getRelocatedAddress(), and llvm::DWARFDebugFrame::parse().
|
inline |
Extracts an address-sized value and applies a relocation to the result if one exists for the given offset.
Definition at line 44 of file DWARFDataExtractor.h.
References llvm::DataExtractor::getAddressSize(), getEncodedPointer(), and getRelocatedValue().
Referenced by llvm::DWARFDebugRangeList::extract(), llvm::DWARFDebugLine::LineTable::parse(), and llvm::DWARFDebugLoc::parseOneLocationList().
uint64_t DWARFDataExtractor::getRelocatedValue | ( | uint32_t | Size, |
uint32_t * | Off, | ||
uint64_t * | SectionIndex = nullptr |
||
) | const |
Extracts a value and applies a relocation to the result if one exists for the given offset.
Definition at line 16 of file DWARFDataExtractor.cpp.
References llvm::DWARFObject::find(), llvm::DataExtractor::getUnsigned(), llvm::RelocAddrEntry::SectionIndex, and llvm::RelocAddrEntry::Value.
Referenced by dumpDWARFv5StringOffsetsSection(), DWARFDataExtractor(), llvm::DWARFDebugPubTable::DWARFDebugPubTable(), llvm::AppleAcceleratorTable::equal_range(), llvm::DWARFUnitHeader::extract(), llvm::DWARFFormValue::extractValue(), and getRelocatedAddress().
|
inline |
Definition at line 55 of file DWARFDataExtractor.h.
References llvm::DWARFSection::Data, and llvm::StringRef::size().