Go to the documentation of this file.
9 #ifndef LLVM_OBJECT_MINIDUMP_H
10 #define LLVM_OBJECT_MINIDUMP_H
51 return getDataSlice(getData(), Desc.
RVA, Desc.
DataSize);
63 return getStream<minidump::SystemInfo>(minidump::StreamType::SystemInfo);
72 return getListStream<minidump::Module>(minidump::StreamType::ModuleList);
81 return getListStream<minidump::Thread>(minidump::StreamType::ThreadList);
89 return getStream<minidump::ExceptionStream>(
90 minidump::StreamType::Exception);
101 return getListStream<minidump::MemoryDescriptor>(
102 minidump::StreamType::MemoryList);
107 std::forward_iterator_tag,
108 minidump::MemoryInfo> {
111 : Storage(Storage), Stride(Stride) {
116 return Storage.
size() == R.Storage.size();
148 static Error createEOFError() {
149 return make_error<GenericBinaryError>(
"Unexpected EOF",
154 static Expected<ArrayRef<uint8_t>> getDataSlice(ArrayRef<uint8_t>
Data,
160 template <
typename T>
161 static Expected<ArrayRef<T>> getDataSliceAs(ArrayRef<uint8_t>
Data,
162 size_t Offset,
size_t Count);
164 MinidumpFile(MemoryBufferRef
Source,
const minidump::Header &Header,
165 ArrayRef<minidump::Directory> Streams,
166 DenseMap<minidump::StreamType, std::size_t> StreamMap)
168 StreamMap(
std::
move(StreamMap)) {}
170 ArrayRef<uint8_t> getData()
const {
176 template <
typename T>
181 template <
typename T>
184 const minidump::Header &Header;
185 ArrayRef<minidump::Directory> Streams;
186 DenseMap<minidump::StreamType, std::size_t> StreamMap;
189 template <
typename T>
192 if (Stream->size() >=
sizeof(T))
193 return *
reinterpret_cast<const T *
>(Stream->data());
194 return createEOFError();
196 return createError(
"No such stream");
199 template <
typename T>
200 Expected<ArrayRef<T>> MinidumpFile::getDataSliceAs(ArrayRef<uint8_t> Data,
205 return createEOFError();
206 Expected<ArrayRef<uint8_t>> Slice =
207 getDataSlice(
Data,
Offset,
sizeof(T) * Count);
209 return Slice.takeError();
210 return ArrayRef<T>(
reinterpret_cast<const T *
>(Slice->data()), Count);
216 #endif // LLVM_OBJECT_MINIDUMP_H
Expected< ArrayRef< minidump::Thread > > getThreadList() const
Returns the thread list embedded in the ThreadList stream.
This class represents lattice values for constants.
MemoryInfoIterator & operator++()
The instances of the Type class are immutable: once they are created, they are never changed.
Tagged union holding either a T or a Error.
Specifies the location (and size) of various objects in the minidump file.
support::ulittle32_t DataSize
Expected< std::string > getString(size_t Offset) const
Returns the minidump string at the given offset.
Expected< const minidump::ExceptionStream & > getExceptionStream() const
Returns the contents of the Exception stream.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LocationDescriptor Location
static Expected< std::unique_ptr< MinidumpFile > > create(MemoryBufferRef Source)
Construct a new MinidumpFile object from the given memory buffer.
MemoryInfoIterator(ArrayRef< uint8_t > Storage, size_t Stride)
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
bar al al movzbl eax ret Missed when stored in a memory object
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
StreamType
The type of a minidump stream identifies its contents.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Expected< ArrayRef< uint8_t > > getRawData(minidump::LocationDescriptor Desc) const
Returns the raw contents of an object given by the LocationDescriptor.
StringRef getBuffer() const
static bool classof(const Binary *B)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const minidump::MemoryInfo & operator*() const
StringRef - Represent a constant reference to a string, i.e.
ArrayRef< minidump::Directory > streams() const
Returns the list of streams (stream directory entries) in this file.
Expected< const minidump::SystemInfo & > getSystemInfo() const
Returns the contents of the SystemInfo stream, cast to the appropriate type.
Specifies the location and type of a single stream in the minidump file.
Lightweight error class with error context and mandatory checking.
ArrayRef< uint8_t > getRawStream(const minidump::Directory &Stream) const
Returns the raw contents of the stream given by the directory entry.
Expected< ArrayRef< minidump::Module > > getModuleList() const
Returns the module list embedded in the ModuleList stream.
const minidump::Header & header() const
Returns the contents of the minidump header.
A class providing access to the contents of a minidump file.
size_t size() const
size - Get the array size.
Align max(MaybeAlign Lhs, Align Rhs)
bool operator==(const MemoryInfoIterator &R) const
Expected< iterator_range< MemoryInfoIterator > > getMemoryInfoList() const
Returns the list of descriptors embedded in the MemoryInfoList stream.
Expected< ArrayRef< minidump::MemoryDescriptor > > getMemoryList() const
Returns the list of descriptors embedded in the MemoryList stream.