LLVM 20.0.0git
MinidumpYAML.cpp
Go to the documentation of this file.
1//===- MinidumpYAML.cpp - Minidump YAMLIO implementation ------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
11
12using namespace llvm;
13using namespace llvm::MinidumpYAML;
14using namespace llvm::minidump;
15
16/// Perform an optional yaml-mapping of an endian-aware type EndianType. The
17/// only purpose of this function is to avoid casting the Default value to the
18/// endian type;
19template <typename EndianType>
20static inline void mapOptional(yaml::IO &IO, const char *Key, EndianType &Val,
21 typename EndianType::value_type Default) {
22 IO.mapOptional(Key, Val, EndianType(Default));
23}
24
25/// Yaml-map an endian-aware type EndianType as some other type MapType.
26template <typename MapType, typename EndianType>
27static inline void mapRequiredAs(yaml::IO &IO, const char *Key,
28 EndianType &Val) {
29 MapType Mapped = static_cast<typename EndianType::value_type>(Val);
30 IO.mapRequired(Key, Mapped);
31 Val = static_cast<typename EndianType::value_type>(Mapped);
32}
33
34/// Perform an optional yaml-mapping of an endian-aware type EndianType as some
35/// other type MapType.
36template <typename MapType, typename EndianType>
37static inline void mapOptionalAs(yaml::IO &IO, const char *Key, EndianType &Val,
38 MapType Default) {
39 MapType Mapped = static_cast<typename EndianType::value_type>(Val);
40 IO.mapOptional(Key, Mapped, Default);
41 Val = static_cast<typename EndianType::value_type>(Mapped);
42}
43
44namespace {
45/// Return the appropriate yaml Hex type for a given endian-aware type.
46template <typename EndianType> struct HexType;
47template <> struct HexType<support::ulittle16_t> { using type = yaml::Hex16; };
48template <> struct HexType<support::ulittle32_t> { using type = yaml::Hex32; };
49template <> struct HexType<support::ulittle64_t> { using type = yaml::Hex64; };
50} // namespace
51
52/// Yaml-map an endian-aware type as an appropriately-sized hex value.
53template <typename EndianType>
54static inline void mapRequiredHex(yaml::IO &IO, const char *Key,
55 EndianType &Val) {
56 mapRequiredAs<typename HexType<EndianType>::type>(IO, Key, Val);
57}
58
59/// Perform an optional yaml-mapping of an endian-aware type as an
60/// appropriately-sized hex value.
61template <typename EndianType>
62static inline void mapOptionalHex(yaml::IO &IO, const char *Key,
63 EndianType &Val,
64 typename EndianType::value_type Default) {
65 mapOptionalAs<typename HexType<EndianType>::type>(IO, Key, Val, Default);
66}
67
68Stream::~Stream() = default;
69
71 switch (Type) {
72 case StreamType::Exception:
74 case StreamType::MemoryInfoList:
76 case StreamType::MemoryList:
78 case StreamType::Memory64List:
80 case StreamType::ModuleList:
82 case StreamType::SystemInfo:
84 case StreamType::LinuxCPUInfo:
85 case StreamType::LinuxProcStatus:
86 case StreamType::LinuxLSBRelease:
87 case StreamType::LinuxCMDLine:
88 case StreamType::LinuxMaps:
89 case StreamType::LinuxProcStat:
90 case StreamType::LinuxProcUptime:
92 case StreamType::ThreadList:
94 default:
96 }
97}
98
99std::unique_ptr<Stream> Stream::create(StreamType Type) {
101 switch (Kind) {
103 return std::make_unique<ExceptionStream>();
105 return std::make_unique<MemoryInfoListStream>();
107 return std::make_unique<MemoryListStream>();
109 return std::make_unique<Memory64ListStream>();
111 return std::make_unique<ModuleListStream>();
113 return std::make_unique<RawContentStream>(Type);
115 return std::make_unique<SystemInfoStream>();
117 return std::make_unique<TextContentStream>(Type);
119 return std::make_unique<ThreadListStream>();
120 }
121 llvm_unreachable("Unhandled stream kind!");
122}
123
124void yaml::ScalarBitSetTraits<MemoryProtection>::bitset(
125 IO &IO, MemoryProtection &Protect) {
126#define HANDLE_MDMP_PROTECT(CODE, NAME, NATIVENAME) \
127 IO.bitSetCase(Protect, #NATIVENAME, MemoryProtection::NAME);
128#include "llvm/BinaryFormat/MinidumpConstants.def"
129}
130
131void yaml::ScalarBitSetTraits<MemoryState>::bitset(IO &IO, MemoryState &State) {
132#define HANDLE_MDMP_MEMSTATE(CODE, NAME, NATIVENAME) \
133 IO.bitSetCase(State, #NATIVENAME, MemoryState::NAME);
134#include "llvm/BinaryFormat/MinidumpConstants.def"
135}
136
137void yaml::ScalarBitSetTraits<MemoryType>::bitset(IO &IO, MemoryType &Type) {
138#define HANDLE_MDMP_MEMTYPE(CODE, NAME, NATIVENAME) \
139 IO.bitSetCase(Type, #NATIVENAME, MemoryType::NAME);
140#include "llvm/BinaryFormat/MinidumpConstants.def"
141}
142
143void yaml::ScalarEnumerationTraits<ProcessorArchitecture>::enumeration(
144 IO &IO, ProcessorArchitecture &Arch) {
145#define HANDLE_MDMP_ARCH(CODE, NAME) \
146 IO.enumCase(Arch, #NAME, ProcessorArchitecture::NAME);
147#include "llvm/BinaryFormat/MinidumpConstants.def"
148 IO.enumFallback<Hex16>(Arch);
149}
150
151void yaml::ScalarEnumerationTraits<OSPlatform>::enumeration(IO &IO,
152 OSPlatform &Plat) {
153#define HANDLE_MDMP_PLATFORM(CODE, NAME) \
154 IO.enumCase(Plat, #NAME, OSPlatform::NAME);
155#include "llvm/BinaryFormat/MinidumpConstants.def"
156 IO.enumFallback<Hex32>(Plat);
157}
158
159void yaml::ScalarEnumerationTraits<StreamType>::enumeration(IO &IO,
160 StreamType &Type) {
161#define HANDLE_MDMP_STREAM_TYPE(CODE, NAME) \
162 IO.enumCase(Type, #NAME, StreamType::NAME);
163#include "llvm/BinaryFormat/MinidumpConstants.def"
164 IO.enumFallback<Hex32>(Type);
165}
166
168 CPUInfo::ArmInfo &Info) {
169 mapRequiredHex(IO, "CPUID", Info.CPUID);
170 mapOptionalHex(IO, "ELF hwcaps", Info.ElfHWCaps, 0);
171}
172
173namespace {
174template <std::size_t N> struct FixedSizeHex {
175 FixedSizeHex(uint8_t (&Storage)[N]) : Storage(Storage) {}
176
177 uint8_t (&Storage)[N];
178};
179} // namespace
180
181namespace llvm {
182namespace yaml {
183template <std::size_t N> struct ScalarTraits<FixedSizeHex<N>> {
184 static void output(const FixedSizeHex<N> &Fixed, void *, raw_ostream &OS) {
185 OS << toHex(ArrayRef(Fixed.Storage));
186 }
187
188 static StringRef input(StringRef Scalar, void *, FixedSizeHex<N> &Fixed) {
189 if (!all_of(Scalar, isHexDigit))
190 return "Invalid hex digit in input";
191 if (Scalar.size() < 2 * N)
192 return "String too short";
193 if (Scalar.size() > 2 * N)
194 return "String too long";
195 copy(fromHex(Scalar), Fixed.Storage);
196 return "";
197 }
198
199 static QuotingType mustQuote(StringRef S) { return QuotingType::None; }
200};
201} // namespace yaml
202} // namespace llvm
204 IO &IO, CPUInfo::OtherInfo &Info) {
205 FixedSizeHex<sizeof(Info.ProcessorFeatures)> Features(Info.ProcessorFeatures);
206 IO.mapRequired("Features", Features);
207}
208
209namespace {
210/// A type which only accepts strings of a fixed size for yaml conversion.
211template <std::size_t N> struct FixedSizeString {
212 FixedSizeString(char (&Storage)[N]) : Storage(Storage) {}
213
214 char (&Storage)[N];
215};
216} // namespace
217
218namespace llvm {
219namespace yaml {
220template <std::size_t N> struct ScalarTraits<FixedSizeString<N>> {
221 static void output(const FixedSizeString<N> &Fixed, void *, raw_ostream &OS) {
222 OS << StringRef(Fixed.Storage, N);
223 }
224
225 static StringRef input(StringRef Scalar, void *, FixedSizeString<N> &Fixed) {
226 if (Scalar.size() < N)
227 return "String too short";
228 if (Scalar.size() > N)
229 return "String too long";
230 copy(Scalar, Fixed.Storage);
231 return "";
232 }
233
234 static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
235};
236} // namespace yaml
237} // namespace llvm
238
240 CPUInfo::X86Info &Info) {
241 FixedSizeString<sizeof(Info.VendorID)> VendorID(Info.VendorID);
242 IO.mapRequired("Vendor ID", VendorID);
243
244 mapRequiredHex(IO, "Version Info", Info.VersionInfo);
245 mapRequiredHex(IO, "Feature Info", Info.FeatureInfo);
246 mapOptionalHex(IO, "AMD Extended Features", Info.AMDExtendedFeatures, 0);
247}
248
250 mapRequiredHex(IO, "Base Address", Info.BaseAddress);
251 mapOptionalHex(IO, "Allocation Base", Info.AllocationBase, Info.BaseAddress);
252 mapRequiredAs<MemoryProtection>(IO, "Allocation Protect",
253 Info.AllocationProtect);
254 mapOptionalHex(IO, "Reserved0", Info.Reserved0, 0);
255 mapRequiredHex(IO, "Region Size", Info.RegionSize);
256 mapRequiredAs<MemoryState>(IO, "State", Info.State);
257 mapOptionalAs<MemoryProtection>(IO, "Protect", Info.Protect,
258 Info.AllocationProtect);
259 mapRequiredAs<MemoryType>(IO, "Type", Info.Type);
260 mapOptionalHex(IO, "Reserved1", Info.Reserved1, 0);
261}
262
264 IO &IO, Memory64ListStream::entry_type &Mem) {
265 MappingContextTraits<MemoryDescriptor_64, yaml::BinaryRef>::mapping(
266 IO, Mem.Entry, Mem.Content);
267}
268
270 VSFixedFileInfo &Info) {
271 mapOptionalHex(IO, "Signature", Info.Signature, 0);
272 mapOptionalHex(IO, "Struct Version", Info.StructVersion, 0);
273 mapOptionalHex(IO, "File Version High", Info.FileVersionHigh, 0);
274 mapOptionalHex(IO, "File Version Low", Info.FileVersionLow, 0);
275 mapOptionalHex(IO, "Product Version High", Info.ProductVersionHigh, 0);
276 mapOptionalHex(IO, "Product Version Low", Info.ProductVersionLow, 0);
277 mapOptionalHex(IO, "File Flags Mask", Info.FileFlagsMask, 0);
278 mapOptionalHex(IO, "File Flags", Info.FileFlags, 0);
279 mapOptionalHex(IO, "File OS", Info.FileOS, 0);
280 mapOptionalHex(IO, "File Type", Info.FileType, 0);
281 mapOptionalHex(IO, "File Subtype", Info.FileSubtype, 0);
282 mapOptionalHex(IO, "File Date High", Info.FileDateHigh, 0);
283 mapOptionalHex(IO, "File Date Low", Info.FileDateLow, 0);
284}
285
287 IO &IO, ModuleListStream::entry_type &M) {
288 mapRequiredHex(IO, "Base of Image", M.Entry.BaseOfImage);
289 mapRequiredHex(IO, "Size of Image", M.Entry.SizeOfImage);
290 mapOptionalHex(IO, "Checksum", M.Entry.Checksum, 0);
291 mapOptional(IO, "Time Date Stamp", M.Entry.TimeDateStamp, 0);
292 IO.mapRequired("Module Name", M.Name);
293 IO.mapOptional("Version Info", M.Entry.VersionInfo, VSFixedFileInfo());
294 IO.mapRequired("CodeView Record", M.CvRecord);
295 IO.mapOptional("Misc Record", M.MiscRecord, yaml::BinaryRef());
296 mapOptionalHex(IO, "Reserved0", M.Entry.Reserved0, 0);
297 mapOptionalHex(IO, "Reserved1", M.Entry.Reserved1, 0);
298}
299
300static void streamMapping(yaml::IO &IO, RawContentStream &Stream) {
301 IO.mapOptional("Content", Stream.Content);
302 IO.mapOptional("Size", Stream.Size, Stream.Content.binary_size());
303}
304
306 if (Stream.Size.value < Stream.Content.binary_size())
307 return "Stream size must be greater or equal to the content size";
308 return "";
309}
310
313 MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(
314 IO, Range.Entry, Range.Content);
315}
316
317static void streamMapping(yaml::IO &IO, MemoryInfoListStream &Stream) {
318 IO.mapRequired("Memory Ranges", Stream.Infos);
319}
320
321static void streamMapping(yaml::IO &IO, MemoryListStream &Stream) {
322 IO.mapRequired("Memory Ranges", Stream.Entries);
323}
324
325static void streamMapping(yaml::IO &IO, Memory64ListStream &Stream) {
326 IO.mapRequired("Memory Ranges", Stream.Entries);
327}
328
330 for (auto &Entry : Stream.Entries) {
331 if (Entry.Entry.DataSize < Entry.Content.binary_size())
332 return "Memory region size must be greater or equal to the content size";
333 }
334 return "";
335}
336
337static void streamMapping(yaml::IO &IO, ModuleListStream &Stream) {
338 IO.mapRequired("Modules", Stream.Entries);
339}
340
341static void streamMapping(yaml::IO &IO, SystemInfoStream &Stream) {
342 SystemInfo &Info = Stream.Info;
343 IO.mapRequired("Processor Arch", Info.ProcessorArch);
344 mapOptional(IO, "Processor Level", Info.ProcessorLevel, 0);
345 mapOptional(IO, "Processor Revision", Info.ProcessorRevision, 0);
346 IO.mapOptional("Number of Processors", Info.NumberOfProcessors, 0);
347 IO.mapOptional("Product type", Info.ProductType, 0);
348 mapOptional(IO, "Major Version", Info.MajorVersion, 0);
349 mapOptional(IO, "Minor Version", Info.MinorVersion, 0);
350 mapOptional(IO, "Build Number", Info.BuildNumber, 0);
351 IO.mapRequired("Platform ID", Info.PlatformId);
352 IO.mapOptional("CSD Version", Stream.CSDVersion, "");
353 mapOptionalHex(IO, "Suite Mask", Info.SuiteMask, 0);
354 mapOptionalHex(IO, "Reserved", Info.Reserved, 0);
355 switch (static_cast<ProcessorArchitecture>(Info.ProcessorArch)) {
356 case ProcessorArchitecture::X86:
357 case ProcessorArchitecture::AMD64:
358 IO.mapOptional("CPU", Info.CPU.X86);
359 break;
360 case ProcessorArchitecture::ARM:
361 case ProcessorArchitecture::ARM64:
362 case ProcessorArchitecture::BP_ARM64:
363 IO.mapOptional("CPU", Info.CPU.Arm);
364 break;
365 default:
366 IO.mapOptional("CPU", Info.CPU.Other);
367 break;
368 }
369}
370
371static void streamMapping(yaml::IO &IO, TextContentStream &Stream) {
372 IO.mapOptional("Text", Stream.Text);
373}
374
375void yaml::MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(
376 IO &IO, MemoryDescriptor &Memory, BinaryRef &Content) {
377 mapRequiredHex(IO, "Start of Memory Range", Memory.StartOfMemoryRange);
378 IO.mapRequired("Content", Content);
379}
380
381void yaml::MappingContextTraits<MemoryDescriptor_64, yaml::BinaryRef>::mapping(
382 IO &IO, MemoryDescriptor_64 &Memory, BinaryRef &Content) {
383 mapRequiredHex(IO, "Start of Memory Range", Memory.StartOfMemoryRange);
384 IO.mapRequired("Content", Content);
385 mapOptional(IO, "Data Size", Memory.DataSize, Content.binary_size());
386}
387
390 mapRequiredHex(IO, "Thread Id", T.Entry.ThreadId);
391 mapOptionalHex(IO, "Suspend Count", T.Entry.SuspendCount, 0);
392 mapOptionalHex(IO, "Priority Class", T.Entry.PriorityClass, 0);
393 mapOptionalHex(IO, "Priority", T.Entry.Priority, 0);
394 mapOptionalHex(IO, "Environment Block", T.Entry.EnvironmentBlock, 0);
395 IO.mapRequired("Context", T.Context);
396 IO.mapRequired("Stack", T.Entry.Stack, T.Stack);
397}
398
399static void streamMapping(yaml::IO &IO, ThreadListStream &Stream) {
400 IO.mapRequired("Threads", Stream.Entries);
401}
402
404 mapRequiredHex(IO, "Thread ID", Stream.MDExceptionStream.ThreadId);
405 IO.mapRequired("Exception Record", Stream.MDExceptionStream.ExceptionRecord);
406 IO.mapRequired("Thread Context", Stream.ThreadContext);
407}
408
410 yaml::IO &IO, minidump::Exception &Exception) {
411 mapRequiredHex(IO, "Exception Code", Exception.ExceptionCode);
412 mapOptionalHex(IO, "Exception Flags", Exception.ExceptionFlags, 0);
413 mapOptionalHex(IO, "Exception Record", Exception.ExceptionRecord, 0);
414 mapOptionalHex(IO, "Exception Address", Exception.ExceptionAddress, 0);
415 mapOptional(IO, "Number of Parameters", Exception.NumberParameters, 0);
416
417 for (size_t Index = 0; Index < Exception.MaxParameters; ++Index) {
418 SmallString<16> Name("Parameter ");
421
423 mapRequiredHex(IO, Name.c_str(), Field);
424 else
425 mapOptionalHex(IO, Name.c_str(), Field, 0);
426 }
427}
428
430 yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {
432 if (IO.outputting())
433 Type = S->Type;
434 IO.mapRequired("Type", Type);
435
436 if (!IO.outputting())
438 switch (S->Kind) {
440 streamMapping(IO, llvm::cast<MinidumpYAML::ExceptionStream>(*S));
441 break;
443 streamMapping(IO, llvm::cast<MemoryInfoListStream>(*S));
444 break;
446 streamMapping(IO, llvm::cast<MemoryListStream>(*S));
447 break;
449 streamMapping(IO, llvm::cast<Memory64ListStream>(*S));
450 break;
452 streamMapping(IO, llvm::cast<ModuleListStream>(*S));
453 break;
455 streamMapping(IO, llvm::cast<RawContentStream>(*S));
456 break;
458 streamMapping(IO, llvm::cast<SystemInfoStream>(*S));
459 break;
461 streamMapping(IO, llvm::cast<TextContentStream>(*S));
462 break;
464 streamMapping(IO, llvm::cast<ThreadListStream>(*S));
465 break;
466 }
467}
468
470 yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {
471 switch (S->Kind) {
473 return streamValidate(cast<RawContentStream>(*S));
475 return streamValidate(cast<Memory64ListStream>(*S));
483 return "";
484 }
485 llvm_unreachable("Fully covered switch above!");
486}
487
489 IO.mapTag("!minidump", true);
490 mapOptionalHex(IO, "Signature", O.Header.Signature, Header::MagicSignature);
491 mapOptionalHex(IO, "Version", O.Header.Version, Header::MagicVersion);
492 mapOptionalHex(IO, "Flags", O.Header.Flags, 0);
493 IO.mapRequired("Streams", O.Streams);
494}
495
497Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
498 StreamKind Kind = getKind(StreamDesc.Type);
499 switch (Kind) {
501 Expected<const minidump::ExceptionStream &> ExpectedExceptionStream =
502 File.getExceptionStream();
503 if (!ExpectedExceptionStream)
504 return ExpectedExceptionStream.takeError();
505 Expected<ArrayRef<uint8_t>> ExpectedThreadContext =
506 File.getRawData(ExpectedExceptionStream->ThreadContext);
507 if (!ExpectedThreadContext)
508 return ExpectedThreadContext.takeError();
509 return std::make_unique<ExceptionStream>(*ExpectedExceptionStream,
510 *ExpectedThreadContext);
511 }
513 if (auto ExpectedList = File.getMemoryInfoList())
514 return std::make_unique<MemoryInfoListStream>(*ExpectedList);
515 else
516 return ExpectedList.takeError();
517 }
519 auto ExpectedList = File.getMemoryList();
520 if (!ExpectedList)
521 return ExpectedList.takeError();
522 std::vector<MemoryListStream::entry_type> Ranges;
523 for (const MemoryDescriptor &MD : *ExpectedList) {
524 auto ExpectedContent = File.getRawData(MD.Memory);
525 if (!ExpectedContent)
526 return ExpectedContent.takeError();
527 Ranges.push_back({MD, *ExpectedContent});
528 }
529 return std::make_unique<MemoryListStream>(std::move(Ranges));
530 }
532 Error Err = Error::success();
533 auto Memory64List = File.getMemory64List(Err);
534 std::vector<Memory64ListStream::entry_type> Ranges;
535 for (const auto &Pair : Memory64List) {
536 Ranges.push_back({Pair.first, Pair.second});
537 }
538
539 if (Err)
540 return Err;
541 return std::make_unique<Memory64ListStream>(std::move(Ranges));
542 }
544 auto ExpectedList = File.getModuleList();
545 if (!ExpectedList)
546 return ExpectedList.takeError();
547 std::vector<ModuleListStream::entry_type> Modules;
548 for (const Module &M : *ExpectedList) {
549 auto ExpectedName = File.getString(M.ModuleNameRVA);
550 if (!ExpectedName)
551 return ExpectedName.takeError();
552 auto ExpectedCv = File.getRawData(M.CvRecord);
553 if (!ExpectedCv)
554 return ExpectedCv.takeError();
555 auto ExpectedMisc = File.getRawData(M.MiscRecord);
556 if (!ExpectedMisc)
557 return ExpectedMisc.takeError();
558 Modules.push_back(
559 {M, std::move(*ExpectedName), *ExpectedCv, *ExpectedMisc});
560 }
561 return std::make_unique<ModuleListStream>(std::move(Modules));
562 }
564 return std::make_unique<RawContentStream>(StreamDesc.Type,
565 File.getRawStream(StreamDesc));
567 auto ExpectedInfo = File.getSystemInfo();
568 if (!ExpectedInfo)
569 return ExpectedInfo.takeError();
570 auto ExpectedCSDVersion = File.getString(ExpectedInfo->CSDVersionRVA);
571 if (!ExpectedCSDVersion)
572 return ExpectedInfo.takeError();
573 return std::make_unique<SystemInfoStream>(*ExpectedInfo,
574 std::move(*ExpectedCSDVersion));
575 }
577 return std::make_unique<TextContentStream>(
578 StreamDesc.Type, toStringRef(File.getRawStream(StreamDesc)));
580 auto ExpectedList = File.getThreadList();
581 if (!ExpectedList)
582 return ExpectedList.takeError();
583 std::vector<ThreadListStream::entry_type> Threads;
584 for (const Thread &T : *ExpectedList) {
585 auto ExpectedStack = File.getRawData(T.Stack.Memory);
586 if (!ExpectedStack)
587 return ExpectedStack.takeError();
588 auto ExpectedContext = File.getRawData(T.Context);
589 if (!ExpectedContext)
590 return ExpectedContext.takeError();
591 Threads.push_back({T, *ExpectedStack, *ExpectedContext});
592 }
593 return std::make_unique<ThreadListStream>(std::move(Threads));
594 }
595 }
596 llvm_unreachable("Unhandled stream kind!");
597}
598
600 std::vector<std::unique_ptr<Stream>> Streams;
601 Streams.reserve(File.streams().size());
602 for (const Directory &StreamDesc : File.streams()) {
603 auto ExpectedStream = Stream::create(StreamDesc, File);
604 if (!ExpectedStream)
605 return ExpectedStream.takeError();
606 Streams.push_back(std::move(*ExpectedStream));
607 }
608 return Object(File.header(), std::move(Streams));
609}
This file defines the BumpPtrAllocator interface.
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
@ Default
Definition: DwarfDebug.cpp:87
T Content
std::string Name
static void mapOptionalHex(yaml::IO &IO, const char *Key, EndianType &Val, typename EndianType::value_type Default)
Perform an optional yaml-mapping of an endian-aware type as an appropriately-sized hex value.
static void mapRequiredAs(yaml::IO &IO, const char *Key, EndianType &Val)
Yaml-map an endian-aware type EndianType as some other type MapType.
static std::string streamValidate(RawContentStream &Stream)
static void mapOptionalAs(yaml::IO &IO, const char *Key, EndianType &Val, MapType Default)
Perform an optional yaml-mapping of an endian-aware type EndianType as some other type MapType.
static void mapRequiredHex(yaml::IO &IO, const char *Key, EndianType &Val)
Yaml-map an endian-aware type as an appropriately-sized hex value.
static void streamMapping(yaml::IO &IO, RawContentStream &Stream)
static void mapOptional(yaml::IO &IO, const char *Key, EndianType &Val, typename EndianType::value_type Default)
Perform an optional yaml-mapping of an endian-aware type EndianType.
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
static bool isHexDigit(const char C)
raw_pwrite_stream & OS
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
static ErrorSuccess success()
Create a success value.
Definition: Error.h:337
Tagged union holding either a T or a Error.
Definition: Error.h:481
Error takeError()
Take ownership of the stored error.
Definition: Error.h:608
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...
Definition: SmallString.h:26
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
void toVector(SmallVectorImpl< char > &Out) const
Append the concatenated string into the given SmallString or SmallVector.
Definition: Twine.cpp:32
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:93
A class providing access to the contents of a minidump file.
Definition: Minidump.h:24
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This class provides various memory handling functions that manipulate MemoryBlock instances.
Definition: Memory.h:52
Specialized YAMLIO scalar type for representing a binary blob.
Definition: YAML.h:63
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
StringRef toStringRef(const std::optional< DWARFFormValue > &V, StringRef Default={})
Take an optional DWARFFormValue and try to extract a string value from it.
ProcessorArchitecture
The processor architecture of the system that generated this minidump.
Definition: Minidump.h:145
StreamType
The type of a minidump stream identifies its contents.
Definition: Minidump.h:50
OSPlatform
The OS Platform of the system that generated this minidump.
Definition: Minidump.h:152
detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned > ulittle16_t
Definition: Endian.h:282
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
Definition: Endian.h:285
detail::packed_endian_specific_integral< uint64_t, llvm::endianness::little, unaligned > ulittle64_t
Definition: Endian.h:288
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1722
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1824
#define N
ExceptionStream minidump stream.
Definition: MinidumpYAML.h:127
A structure containing the list of MemoryInfo entries comprising a MemoryInfoList stream.
Definition: MinidumpYAML.h:147
The top level structure representing a minidump object, consisting of a minidump header,...
Definition: MinidumpYAML.h:220
std::vector< std::unique_ptr< Stream > > Streams
The list of streams in this minidump object.
Definition: MinidumpYAML.h:235
static Expected< Object > create(const object::MinidumpFile &File)
A minidump stream represented as a sequence of hex bytes.
Definition: MinidumpYAML.h:167
The base class for all minidump streams.
Definition: MinidumpYAML.h:27
static std::unique_ptr< Stream > create(minidump::StreamType Type)
Create an empty stream of the given Type.
const StreamKind Kind
Definition: MinidumpYAML.h:43
static StreamKind getKind(minidump::StreamType Type)
Get the stream Kind used for representing streams of a given Type.
SystemInfo minidump stream.
Definition: MinidumpYAML.h:181
A StringRef, which is printed using YAML block notation.
Definition: MinidumpYAML.h:205
A stream representing a list of abstract entries in a minidump stream.
Definition: MinidumpYAML.h:62
Specifies the location and type of a single stream in the minidump file.
Definition: Minidump.h:137
support::little_t< StreamType > Type
Definition: Minidump.h:138
static constexpr size_t MaxParameters
Definition: Minidump.h:248
support::ulittle32_t ExceptionFlags
Definition: Minidump.h:251
support::ulittle32_t NumberParameters
Definition: Minidump.h:254
support::ulittle64_t ExceptionInformation[MaxParameters]
Definition: Minidump.h:256
support::ulittle64_t ExceptionRecord
Definition: Minidump.h:252
support::ulittle64_t ExceptionAddress
Definition: Minidump.h:253
support::ulittle32_t ExceptionCode
Definition: Minidump.h:250
static constexpr uint32_t MagicSignature
Definition: Minidump.h:33
static constexpr uint16_t MagicVersion
Definition: Minidump.h:34
Describes a single memory range (both its VM address and where to find it in the file) of the process...
Definition: Minidump.h:67
The SystemInfo stream, containing various information about the system where this minidump was genera...
Definition: Minidump.h:178
Describes a single thread in the minidump file.
Definition: Minidump.h:236
static QuotingType mustQuote(StringRef S)
static StringRef input(StringRef Scalar, void *, FixedSizeHex< N > &Fixed)
static void output(const FixedSizeHex< N > &Fixed, void *, raw_ostream &OS)
static QuotingType mustQuote(StringRef S)
static StringRef input(StringRef Scalar, void *, FixedSizeString< N > &Fixed)
static void output(const FixedSizeString< N > &Fixed, void *, raw_ostream &OS)