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;
107 return createEOFError();
114 auto ExpectedHeader = getDataSliceAs<minidump::Header>(
Data, 0, 1);
116 return ExpectedHeader.takeError();
120 return createError(
"Invalid signature");
122 return createError(
"Invalid version");
126 if (!ExpectedStreams)
127 return ExpectedStreams.takeError();
130 for (
const auto &StreamDescriptor :
llvm::enumerate(*ExpectedStreams)) {
147 return createError(
"Cannot handle one of the minidump streams");
151 return createError(
"Duplicate stream type");
154 return std::unique_ptr<MinidumpFile>(
155 new MinidumpFile(Source, Hdr, *ExpectedStreams, std::move(StreamMap)));
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)
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)
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.
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.
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