Go to the documentation of this file.
32 size_t tell()
const {
return NextOffset; }
34 size_t allocateCallback(
size_t Size,
36 size_t Offset = NextOffset;
43 return allocateCallback(
49 Data.writeAsBinary(OS);
53 template <
typename T>
size_t allocateArray(
ArrayRef<T> Data) {
54 return allocateBytes({
reinterpret_cast<const uint8_t *
>(
Data.data()),
55 sizeof(
T) *
Data.size()});
58 template <
typename T,
typename RangeType>
59 std::pair<size_t, MutableArrayRef<T>>
62 template <
typename T>
size_t allocateObject(
const T &Data) {
63 return allocateArray(
ArrayRef(Data));
66 template <
typename T,
typename...
Types>
67 std::pair<size_t, T *> allocateNewObject(Types &&...
Args) {
68 T *
Object =
new (Temporaries.Allocate<
T>())
T(std::forward<Types>(
Args)...);
77 size_t NextOffset = 0;
84 template <
typename T,
typename RangeType>
85 std::pair<size_t, MutableArrayRef<T>>
87 size_t Num = std::distance(
Range.begin(),
Range.end());
90 return {allocateArray(Array),
Array};
93 size_t BlobAllocator::allocateString(
StringRef Str) {
96 assert(OK &&
"Invalid UTF8 in Str?");
103 allocateNewObject<support::ulittle32_t>(2 * (WStr.size() - 1)).first;
104 allocateNewArray<support::ulittle16_t>(
make_range(WStr.begin(), WStr.end()));
108 void BlobAllocator::writeTo(
raw_ostream &OS)
const {
109 size_t BeginOffset = OS.
tell();
110 for (
const auto &Callback : Callbacks)
112 assert(OS.
tell() == BeginOffset + NextOffset &&
113 "Callbacks wrote an unexpected number of bytes.");
123 File.allocateObject(
S.MDExceptionStream);
125 size_t DataEnd = File.tell();
134 S.MDExceptionStream.ThreadContext =
layout(File,
S.ThreadContext);
140 Range.Entry.Memory =
layout(File, Range.Content);
144 M.Entry.ModuleNameRVA =
File.allocateString(
M.Name);
146 M.Entry.CvRecord =
layout(File,
M.CvRecord);
147 M.Entry.MiscRecord =
layout(File,
M.MiscRecord);
151 T.Entry.Stack.Memory =
layout(File,
T.Stack);
152 T.Entry.Context =
layout(File,
T.Context);
155 template <
typename EntryT>
156 static size_t layout(BlobAllocator &File,
160 for (
auto &
E :
S.Entries)
161 File.allocateObject(
E.Entry);
163 size_t DataEnd = File.tell();
166 DataEnd = File.tell();
167 for (
auto &
E :
S.Entries)
175 Result.Type =
S.Type;
176 Result.Location.RVA = File.tell();
177 std::optional<size_t> DataEnd;
179 case Stream::StreamKind::Exception:
180 DataEnd =
layout(File, cast<MinidumpYAML::ExceptionStream>(
S));
182 case Stream::StreamKind::MemoryInfoList: {
186 InfoList.
Infos.size());
190 case Stream::StreamKind::MemoryList:
191 DataEnd =
layout(File, cast<MemoryListStream>(
S));
193 case Stream::StreamKind::ModuleList:
194 DataEnd =
layout(File, cast<ModuleListStream>(
S));
196 case Stream::StreamKind::RawContent: {
199 Raw.Content.writeAsBinary(OS);
200 assert(Raw.Content.binary_size() <= Raw.Size);
201 OS << std::string(Raw.Size - Raw.Content.binary_size(),
'\0');
205 case Stream::StreamKind::SystemInfo: {
209 DataEnd = File.tell();
213 case Stream::StreamKind::TextContent:
214 File.allocateArray(arrayRefFromStringRef(cast<TextContentStream>(
S).Text));
216 case Stream::StreamKind::ThreadList:
217 DataEnd =
layout(File, cast<ThreadListStream>(
S));
222 Result.Location.DataSize =
223 DataEnd.value_or(File.tell()) - Result.Location.RVA;
233 File.allocateObject(Obj.
Header);
235 std::vector<Directory> StreamDirectory(Obj.
Streams.size());
uint64_t tell() const
tell - Return the current offset with the file.
This is an optimization pass for GlobalISel generic memory operations.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
The top level structure representing a minidump object, consisting of a minidump header,...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static LocationDescriptor layout(BlobAllocator &File, yaml::BinaryRef Data)
detail::enumerator< R > enumerate(R &&TheRange)
Given an input range, returns a new range whose values are are pair (A,B) such that A is the 0-based ...
Specifies the location (and size) of various objects in the minidump file.
The SystemInfo stream, containing various information about the system where this minidump was genera...
A stream representing a list of abstract entries in a minidump stream.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
minidump::Header Header
The minidump header.
std::vector< std::unique_ptr< Stream > > Streams
The list of streams in this minidump object.
This class implements an extremely fast bulk output stream that can only output to a stream.
An efficient, type-erasing, non-owning reference to a callable.
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Allocate memory in an ever growing pool, as if by bump-pointer.
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
print Print MemDeps of function
The base class for all minidump streams.
SystemInfo minidump stream.
std::vector< minidump::MemoryInfo > Infos
StringRef - Represent a constant reference to a string, i.e.
Specialized YAMLIO scalar type for representing a binary blob.
This class represents a YAML stream potentially containing multiple documents.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
bool convertUTF8ToUTF16String(StringRef SrcUTF8, SmallVectorImpl< UTF16 > &DstUTF16)
Converts a UTF-8 string into a UTF-16 string with native endianness.
Specifies the location and type of a single stream in the minidump file.
bool yaml2minidump(MinidumpYAML::Object &Doc, raw_ostream &Out, ErrorHandler EH)
ExceptionStream minidump stream.
A minidump stream represented as a sequence of hex bytes.
A range adaptor for a pair of iterators.
support::ulittle32_t CSDVersionRVA
ArrayRef(const T &OneElt) -> ArrayRef< T >
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
A structure containing the list of MemoryInfo entries comprising a MemoryInfoList stream.