17std::optional<ArrayRef<uint8_t>>
20 if (It != StreamMap.
end())
30 getDataSliceAs<support::ulittle32_t>(getData(),
Offset, 1);
32 return ExpectedSize.takeError();
33 size_t Size = (*ExpectedSize)[0];
35 return createError(
"String size not even");
42 getDataSliceAs<support::ulittle16_t>(getData(),
Offset,
Size);
44 return ExpectedData.takeError();
51 return createError(
"String decoding failed");
58 std::optional<ArrayRef<uint8_t>> Stream =
61 return createError(
"No such stream");
63 getDataSliceAs<minidump::MemoryInfoListHeader>(*Stream, 0, 1);
65 return ExpectedHeader.takeError();
68 getDataSlice(*Stream,
H.SizeOfHeader,
H.SizeOfEntry *
H.NumberOfEntries);
70 return Data.takeError();
79 return createError(
"No such stream");
80 auto ExpectedSize = getDataSliceAs<support::ulittle32_t>(*Stream, 0, 1);
82 return ExpectedSize.takeError();
84 size_t ListSize = ExpectedSize.get()[0];
86 size_t ListOffset = 4;
90 if (ListOffset +
sizeof(
T) * ListSize < Stream->
size())
93 return getDataSliceAs<T>(*Stream, ListOffset, ListSize);
100 MinidumpFile::getListStream(
StreamType)
const;
108 return createEOFError();
115 auto ExpectedHeader = getDataSliceAs<minidump::Header>(
Data, 0, 1);
117 return ExpectedHeader.takeError();
121 return createError(
"Invalid signature");
123 return createError(
"Invalid version");
127 if (!ExpectedStreams)
128 return ExpectedStreams.takeError();
131 for (
const auto &StreamDescriptor :
llvm::enumerate(*ExpectedStreams)) {
148 return createError(
"Cannot handle one of the minidump streams");
152 return createError(
"Duplicate stream type");
155 return std::unique_ptr<MinidumpFile>(
156 new MinidumpFile(Source, Hdr, *ExpectedStreams, std::move(StreamMap)));
169 std::optional<ArrayRef<uint8_t>> Stream =
172 Err = createError(
"No such stream");
177 getDataSliceAs<minidump::MemoryDescriptor_64>(
179 ListHeader->NumberOfMemoryRanges);
186 if (!Descriptors->empty() &&
187 ListHeader->BaseRVA + Descriptors->front().DataSize > getData().
size()) {
188 Err = createError(
"Memory64List header RVA out of range");
194 getData().slice(ListHeader->BaseRVA), *Descriptors),
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&... Args)
Helper for Errors used as out-parameters.
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
Type(LLVMContext &C, TypeID tid)
static fallible_iterator end(Underlying I)
Construct a fallible iterator that can be used as an end-of-range value.
static fallible_iterator itr(Underlying I, Error &Err)
Construct a fallible iterator that cannot be used as an end-of-range value.
A range adaptor for a pair of iterators.
static Memory64Iterator begin(ArrayRef< uint8_t > Storage, ArrayRef< minidump::MemoryDescriptor_64 > Descriptors)
static Memory64Iterator end()
A class providing access to the contents of a minidump file.
Expected< iterator_range< MemoryInfoIterator > > getMemoryInfoList() const
Returns the list of descriptors embedded in the MemoryInfoList stream.
Expected< minidump::Memory64ListHeader > getMemoryList64Header() const
Returns the header to the memory 64 list stream.
ArrayRef< uint8_t > getRawStream(const minidump::Directory &Stream) const
Returns the raw contents of the stream given by the directory entry.
Expected< std::string > getString(size_t Offset) const
Returns the minidump string at the given offset.
iterator_range< FallibleMemory64Iterator > getMemory64List(Error &Err) const
Returns an iterator that pairs each descriptor with it's respective content from the Memory64List str...
static Expected< std::unique_ptr< MinidumpFile > > create(MemoryBufferRef Source)
Construct a new MinidumpFile object from the given memory buffer.
StreamType
The type of a minidump stream identifies its contents.
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are tuples (A, B,...
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool convertUTF16ToUTF8String(ArrayRef< char > SrcBytes, std::string &Out)
Converts a stream of raw bytes assumed to be UTF16 into a UTF8 std::string.
OutputIt copy(R &&Range, OutputIt Out)
An information struct used to provide DenseMap with the various necessary components for a given valu...
Specifies the location (and size) of various objects in the minidump file.
support::ulittle32_t DataSize