26 "unexpected end of data at offset 0x%zx while reading [0x%" PRIx64
32 " is beyond the end of data at 0x%zx",
41T DataExtractor::getU(uint64_t *offset_ptr,
Error *Err)
const {
42 ErrorAsOutParameter ErrAsOut(Err);
47 uint64_t offset = *offset_ptr;
48 if (!prepareRead(offset,
sizeof(
T), Err))
50 std::memcpy(&val, &Data.data()[offset],
sizeof(val));
55 *offset_ptr +=
sizeof(val);
60T *DataExtractor::getUs(uint64_t *offset_ptr,
T *dst, uint32_t
count,
62 ErrorAsOutParameter ErrAsOut(Err);
66 uint64_t offset = *offset_ptr;
68 if (!prepareRead(offset,
sizeof(*dst) *
count, Err))
70 for (
T *value_ptr = dst, *end = dst +
count; value_ptr !=
end;
71 ++value_ptr, offset +=
sizeof(*dst))
72 *value_ptr = getU<T>(offset_ptr, Err);
81 return getU<uint8_t>(offset_ptr, Err);
86 return getUs<uint8_t>(offset_ptr, dst,
count,
nullptr);
90 return getUs<uint8_t>(&
C.Offset, Dst,
Count, &
C.Err);
94 return getU<uint16_t>(offset_ptr, Err);
99 return getUs<uint16_t>(offset_ptr, dst,
count,
nullptr);
103 uint24_t ExtractedVal = getU<uint24_t>(OffsetPtr, Err);
109 return getU<uint32_t>(offset_ptr, Err);
114 return getUs<uint32_t>(offset_ptr, dst,
count,
nullptr);
118 return getU<uint64_t>(offset_ptr, Err);
123 return getUs<uint64_t>(offset_ptr, dst,
count,
nullptr);
130 return getU8(offset_ptr, Err);
132 return getU16(offset_ptr, Err);
134 return getU32(offset_ptr, Err);
136 return getU64(offset_ptr, Err);
145 return getS8(offset_ptr);
147 return getS16(offset_ptr);
149 return getS32(offset_ptr);
151 return getS64(offset_ptr);
164 *OffsetPtr = Pos + 1;
165 return StringRef(Data.data() + Start, Pos - Start);
169 "no null terminated string at offset 0x%" PRIx64,
178 return Bytes.
trim(TrimChars);
187 if (!prepareRead(*OffsetPtr,
Length, Err))
197 T (&Decoder)(
const uint8_t *p,
unsigned *n,
205 const char *
error =
nullptr;
208 Decoder(Bytes.
data() + *OffsetPtr, &bytes_read, Bytes.
end(), &
error);
212 "unable to decode LEB128 at offset 0x%8.8" PRIx64
217 *OffsetPtr += bytes_read;
234 if (prepareRead(
C.Offset,
Length, &
C.Err))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
Helper for Errors used as out-parameters.
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
StringRef trim(char Char) const
Return string with consecutive Char characters starting from the left and right removed.
static constexpr size_t npos
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
constexpr bool IsLittleEndianHost
void swapByteOrder(T &Value)
This is an optimization pass for GlobalISel generic memory operations.
ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)
Construct a string ref from an array ref of unsigned chars.
uint64_t decodeULEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a ULEB128 value.
int64_t decodeSLEB128(const uint8_t *p, unsigned *n=nullptr, const uint8_t *end=nullptr, const char **error=nullptr)
Utility function to decode a SLEB128 value.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
FunctionAddr VTableAddr Count
FunctionAddr VTableAddr uintptr_t uintptr_t Data
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
uint32_t getAsUint32(bool IsLittleEndian) const