16std::optional<ArrayRef<uint8_t>>
19 if (It != StreamMap.
end())
29 getDataSliceAs<support::ulittle32_t>(getData(),
Offset, 1);
31 return ExpectedSize.takeError();
32 size_t Size = (*ExpectedSize)[0];
34 return createError(
"String size not even");
41 getDataSliceAs<support::ulittle16_t>(getData(),
Offset,
Size);
43 return ExpectedData.takeError();
50 return createError(
"String decoding failed");
63 std::optional<ArrayRef<uint8_t>> Stream =
66 return createError(
"No such stream");
68 getDataSliceAs<minidump::MemoryInfoListHeader>(*Stream, 0, 1);
70 return ExpectedHeader.takeError();
73 getDataSlice(*Stream,
H.SizeOfHeader,
H.SizeOfEntry *
H.NumberOfEntries);
75 return Data.takeError();
86 return createEOFError();
93 auto ExpectedHeader = getDataSliceAs<minidump::Header>(
Data, 0, 1);
95 return ExpectedHeader.takeError();
99 return createError(
"Invalid signature");
101 return createError(
"Invalid version");
105 if (!ExpectedStreams)
106 return ExpectedStreams.takeError();
109 std::vector<Directory> ExceptionStreams;
110 for (
const auto &StreamDescriptor :
llvm::enumerate(*ExpectedStreams)) {
127 if (
Type == StreamType::Exception) {
128 ExceptionStreams.push_back(StreamDescriptor.value());
134 return createError(
"Cannot handle one of the minidump streams");
138 return createError(
"Duplicate stream type");
141 return std::unique_ptr<MinidumpFile>(
142 new MinidumpFile(Source, Hdr, *ExpectedStreams, std::move(StreamMap),
143 std::move(ExceptionStreams)));
156 std::optional<ArrayRef<uint8_t>> Stream =
159 Err = createError(
"No such stream");
164 getDataSliceAs<minidump::MemoryDescriptor_64>(
166 ListHeader->NumberOfMemoryRanges);
173 if (!Descriptors->empty() &&
174 ListHeader->BaseRVA + Descriptors->front().DataSize > getData().
size()) {
175 Err = createError(
"Memory64List header RVA out of range");
181 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.
iterator_range< ExceptionStreamsIterator > getExceptionStreams() const
Returns an iterator that reads each exception stream independently.
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