LLVM  10.0.0svn
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 
10 #include "llvm/Support/Allocator.h"
11 
12 using namespace llvm;
13 using namespace llvm::MinidumpYAML;
14 using 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;
19 template <typename EndianType>
20 static 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.
26 template <typename MapType, typename EndianType>
27 static 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.
36 template <typename MapType, typename EndianType>
37 static 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 
44 namespace {
45 /// Return the appropriate yaml Hex type for a given endian-aware type.
46 template <typename EndianType> struct HexType;
47 template <> struct HexType<support::ulittle16_t> { using type = yaml::Hex16; };
48 template <> struct HexType<support::ulittle32_t> { using type = yaml::Hex32; };
49 template <> 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.
53 template <typename EndianType>
54 static 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.
61 template <typename EndianType>
62 static 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 
68 Stream::~Stream() = default;
69 
71  switch (Type) {
72  case StreamType::MemoryList:
73  return StreamKind::MemoryList;
74  case StreamType::ModuleList:
75  return StreamKind::ModuleList;
76  case StreamType::SystemInfo:
77  return StreamKind::SystemInfo;
78  case StreamType::LinuxCPUInfo:
79  case StreamType::LinuxProcStatus:
80  case StreamType::LinuxLSBRelease:
81  case StreamType::LinuxCMDLine:
82  case StreamType::LinuxMaps:
83  case StreamType::LinuxProcStat:
84  case StreamType::LinuxProcUptime:
85  return StreamKind::TextContent;
86  case StreamType::ThreadList:
87  return StreamKind::ThreadList;
88  default:
89  return StreamKind::RawContent;
90  }
91 }
92 
93 std::unique_ptr<Stream> Stream::create(StreamType Type) {
94  StreamKind Kind = getKind(Type);
95  switch (Kind) {
96  case StreamKind::MemoryList:
97  return std::make_unique<MemoryListStream>();
98  case StreamKind::ModuleList:
99  return std::make_unique<ModuleListStream>();
100  case StreamKind::RawContent:
101  return std::make_unique<RawContentStream>(Type);
102  case StreamKind::SystemInfo:
103  return std::make_unique<SystemInfoStream>();
104  case StreamKind::TextContent:
105  return std::make_unique<TextContentStream>(Type);
106  case StreamKind::ThreadList:
107  return std::make_unique<ThreadListStream>();
108  }
109  llvm_unreachable("Unhandled stream kind!");
110 }
111 
112 void yaml::ScalarEnumerationTraits<ProcessorArchitecture>::enumeration(
113  IO &IO, ProcessorArchitecture &Arch) {
114 #define HANDLE_MDMP_ARCH(CODE, NAME) \
115  IO.enumCase(Arch, #NAME, ProcessorArchitecture::NAME);
116 #include "llvm/BinaryFormat/MinidumpConstants.def"
117  IO.enumFallback<Hex16>(Arch);
118 }
119 
120 void yaml::ScalarEnumerationTraits<OSPlatform>::enumeration(IO &IO,
121  OSPlatform &Plat) {
122 #define HANDLE_MDMP_PLATFORM(CODE, NAME) \
123  IO.enumCase(Plat, #NAME, OSPlatform::NAME);
124 #include "llvm/BinaryFormat/MinidumpConstants.def"
125  IO.enumFallback<Hex32>(Plat);
126 }
127 
128 void yaml::ScalarEnumerationTraits<StreamType>::enumeration(IO &IO,
129  StreamType &Type) {
130 #define HANDLE_MDMP_STREAM_TYPE(CODE, NAME) \
131  IO.enumCase(Type, #NAME, StreamType::NAME);
132 #include "llvm/BinaryFormat/MinidumpConstants.def"
133  IO.enumFallback<Hex32>(Type);
134 }
135 
138  mapRequiredHex(IO, "CPUID", Info.CPUID);
139  mapOptionalHex(IO, "ELF hwcaps", Info.ElfHWCaps, 0);
140 }
141 
142 namespace {
143 template <std::size_t N> struct FixedSizeHex {
144  FixedSizeHex(uint8_t (&Storage)[N]) : Storage(Storage) {}
145 
146  uint8_t (&Storage)[N];
147 };
148 } // namespace
149 
150 namespace llvm {
151 namespace yaml {
152 template <std::size_t N> struct ScalarTraits<FixedSizeHex<N>> {
153  static void output(const FixedSizeHex<N> &Fixed, void *, raw_ostream &OS) {
154  OS << toHex(makeArrayRef(Fixed.Storage));
155  }
156 
157  static StringRef input(StringRef Scalar, void *, FixedSizeHex<N> &Fixed) {
158  if (!all_of(Scalar, isHexDigit))
159  return "Invalid hex digit in input";
160  if (Scalar.size() < 2 * N)
161  return "String too short";
162  if (Scalar.size() > 2 * N)
163  return "String too long";
164  copy(fromHex(Scalar), Fixed.Storage);
165  return "";
166  }
167 
168  static QuotingType mustQuote(StringRef S) { return QuotingType::None; }
169 };
170 } // namespace yaml
171 } // namespace llvm
173  IO &IO, CPUInfo::OtherInfo &Info) {
174  FixedSizeHex<sizeof(Info.ProcessorFeatures)> Features(Info.ProcessorFeatures);
175  IO.mapRequired("Features", Features);
176 }
177 
178 namespace {
179 /// A type which only accepts strings of a fixed size for yaml conversion.
180 template <std::size_t N> struct FixedSizeString {
181  FixedSizeString(char (&Storage)[N]) : Storage(Storage) {}
182 
183  char (&Storage)[N];
184 };
185 } // namespace
186 
187 namespace llvm {
188 namespace yaml {
189 template <std::size_t N> struct ScalarTraits<FixedSizeString<N>> {
190  static void output(const FixedSizeString<N> &Fixed, void *, raw_ostream &OS) {
191  OS << StringRef(Fixed.Storage, N);
192  }
193 
194  static StringRef input(StringRef Scalar, void *, FixedSizeString<N> &Fixed) {
195  if (Scalar.size() < N)
196  return "String too short";
197  if (Scalar.size() > N)
198  return "String too long";
199  copy(Scalar, Fixed.Storage);
200  return "";
201  }
202 
203  static QuotingType mustQuote(StringRef S) { return needsQuotes(S); }
204 };
205 } // namespace yaml
206 } // namespace llvm
207 
209  CPUInfo::X86Info &Info) {
210  FixedSizeString<sizeof(Info.VendorID)> VendorID(Info.VendorID);
211  IO.mapRequired("Vendor ID", VendorID);
212 
213  mapRequiredHex(IO, "Version Info", Info.VersionInfo);
214  mapRequiredHex(IO, "Feature Info", Info.FeatureInfo);
215  mapOptionalHex(IO, "AMD Extended Features", Info.AMDExtendedFeatures, 0);
216 }
217 
219  VSFixedFileInfo &Info) {
220  mapOptionalHex(IO, "Signature", Info.Signature, 0);
221  mapOptionalHex(IO, "Struct Version", Info.StructVersion, 0);
222  mapOptionalHex(IO, "File Version High", Info.FileVersionHigh, 0);
223  mapOptionalHex(IO, "File Version Low", Info.FileVersionLow, 0);
224  mapOptionalHex(IO, "Product Version High", Info.ProductVersionHigh, 0);
225  mapOptionalHex(IO, "Product Version Low", Info.ProductVersionLow, 0);
226  mapOptionalHex(IO, "File Flags Mask", Info.FileFlagsMask, 0);
227  mapOptionalHex(IO, "File Flags", Info.FileFlags, 0);
228  mapOptionalHex(IO, "File OS", Info.FileOS, 0);
229  mapOptionalHex(IO, "File Type", Info.FileType, 0);
230  mapOptionalHex(IO, "File Subtype", Info.FileSubtype, 0);
231  mapOptionalHex(IO, "File Date High", Info.FileDateHigh, 0);
232  mapOptionalHex(IO, "File Date Low", Info.FileDateLow, 0);
233 }
234 
236  IO &IO, ModuleListStream::entry_type &M) {
237  mapRequiredHex(IO, "Base of Image", M.Entry.BaseOfImage);
238  mapRequiredHex(IO, "Size of Image", M.Entry.SizeOfImage);
239  mapOptionalHex(IO, "Checksum", M.Entry.Checksum, 0);
240  IO.mapOptional("Time Date Stamp", M.Entry.TimeDateStamp,
242  IO.mapRequired("Module Name", M.Name);
243  IO.mapOptional("Version Info", M.Entry.VersionInfo, VSFixedFileInfo());
244  IO.mapRequired("CodeView Record", M.CvRecord);
245  IO.mapOptional("Misc Record", M.MiscRecord, yaml::BinaryRef());
246  mapOptionalHex(IO, "Reserved0", M.Entry.Reserved0, 0);
247  mapOptionalHex(IO, "Reserved1", M.Entry.Reserved1, 0);
248 }
249 
250 static void streamMapping(yaml::IO &IO, RawContentStream &Stream) {
251  IO.mapOptional("Content", Stream.Content);
252  IO.mapOptional("Size", Stream.Size, Stream.Content.binary_size());
253 }
254 
256  if (Stream.Size.value < Stream.Content.binary_size())
257  return "Stream size must be greater or equal to the content size";
258  return "";
259 }
260 
262  IO &IO, MemoryListStream::entry_type &Range) {
263  MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(
264  IO, Range.Entry, Range.Content);
265 }
266 
267 static void streamMapping(yaml::IO &IO, MemoryListStream &Stream) {
268  IO.mapRequired("Memory Ranges", Stream.Entries);
269 }
270 
271 static void streamMapping(yaml::IO &IO, ModuleListStream &Stream) {
272  IO.mapRequired("Modules", Stream.Entries);
273 }
274 
275 static void streamMapping(yaml::IO &IO, SystemInfoStream &Stream) {
276  SystemInfo &Info = Stream.Info;
277  IO.mapRequired("Processor Arch", Info.ProcessorArch);
278  mapOptional(IO, "Processor Level", Info.ProcessorLevel, 0);
279  mapOptional(IO, "Processor Revision", Info.ProcessorRevision, 0);
280  IO.mapOptional("Number of Processors", Info.NumberOfProcessors, 0);
281  IO.mapOptional("Product type", Info.ProductType, 0);
282  mapOptional(IO, "Major Version", Info.MajorVersion, 0);
283  mapOptional(IO, "Minor Version", Info.MinorVersion, 0);
284  mapOptional(IO, "Build Number", Info.BuildNumber, 0);
285  IO.mapRequired("Platform ID", Info.PlatformId);
286  IO.mapOptional("CSD Version", Stream.CSDVersion, "");
287  mapOptionalHex(IO, "Suite Mask", Info.SuiteMask, 0);
288  mapOptionalHex(IO, "Reserved", Info.Reserved, 0);
289  switch (static_cast<ProcessorArchitecture>(Info.ProcessorArch)) {
290  case ProcessorArchitecture::X86:
291  case ProcessorArchitecture::AMD64:
292  IO.mapOptional("CPU", Info.CPU.X86);
293  break;
295  case ProcessorArchitecture::ARM64:
296  IO.mapOptional("CPU", Info.CPU.Arm);
297  break;
298  default:
299  IO.mapOptional("CPU", Info.CPU.Other);
300  break;
301  }
302 }
303 
304 static void streamMapping(yaml::IO &IO, TextContentStream &Stream) {
305  IO.mapOptional("Text", Stream.Text);
306 }
307 
308 void yaml::MappingContextTraits<MemoryDescriptor, yaml::BinaryRef>::mapping(
309  IO &IO, MemoryDescriptor &Memory, BinaryRef &Content) {
310  mapRequiredHex(IO, "Start of Memory Range", Memory.StartOfMemoryRange);
311  IO.mapRequired("Content", Content);
312 }
313 
315  IO &IO, ThreadListStream::entry_type &T) {
316  mapRequiredHex(IO, "Thread Id", T.Entry.ThreadId);
317  mapOptionalHex(IO, "Suspend Count", T.Entry.SuspendCount, 0);
318  mapOptionalHex(IO, "Priority Class", T.Entry.PriorityClass, 0);
319  mapOptionalHex(IO, "Priority", T.Entry.Priority, 0);
320  mapOptionalHex(IO, "Environment Block", T.Entry.EnvironmentBlock, 0);
321  IO.mapRequired("Context", T.Context);
322  IO.mapRequired("Stack", T.Entry.Stack, T.Stack);
323 }
324 
325 static void streamMapping(yaml::IO &IO, ThreadListStream &Stream) {
326  IO.mapRequired("Threads", Stream.Entries);
327 }
328 
330  yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {
332  if (IO.outputting())
333  Type = S->Type;
334  IO.mapRequired("Type", Type);
335 
336  if (!IO.outputting())
338  switch (S->Kind) {
340  streamMapping(IO, llvm::cast<MemoryListStream>(*S));
341  break;
343  streamMapping(IO, llvm::cast<ModuleListStream>(*S));
344  break;
346  streamMapping(IO, llvm::cast<RawContentStream>(*S));
347  break;
349  streamMapping(IO, llvm::cast<SystemInfoStream>(*S));
350  break;
352  streamMapping(IO, llvm::cast<TextContentStream>(*S));
353  break;
355  streamMapping(IO, llvm::cast<ThreadListStream>(*S));
356  break;
357  }
358 }
359 
361  yaml::IO &IO, std::unique_ptr<MinidumpYAML::Stream> &S) {
362  switch (S->Kind) {
364  return streamValidate(cast<RawContentStream>(*S));
370  return "";
371  }
372  llvm_unreachable("Fully covered switch above!");
373 }
374 
376  IO.mapTag("!minidump", true);
377  mapOptionalHex(IO, "Signature", O.Header.Signature, Header::MagicSignature);
378  mapOptionalHex(IO, "Version", O.Header.Version, Header::MagicVersion);
379  mapOptionalHex(IO, "Flags", O.Header.Flags, 0);
380  IO.mapRequired("Streams", O.Streams);
381 }
382 
384 Stream::create(const Directory &StreamDesc, const object::MinidumpFile &File) {
385  StreamKind Kind = getKind(StreamDesc.Type);
386  switch (Kind) {
387  case StreamKind::MemoryList: {
388  auto ExpectedList = File.getMemoryList();
389  if (!ExpectedList)
390  return ExpectedList.takeError();
391  std::vector<MemoryListStream::entry_type> Ranges;
392  for (const MemoryDescriptor &MD : *ExpectedList) {
393  auto ExpectedContent = File.getRawData(MD.Memory);
394  if (!ExpectedContent)
395  return ExpectedContent.takeError();
396  Ranges.push_back({MD, *ExpectedContent});
397  }
398  return std::make_unique<MemoryListStream>(std::move(Ranges));
399  }
400  case StreamKind::ModuleList: {
401  auto ExpectedList = File.getModuleList();
402  if (!ExpectedList)
403  return ExpectedList.takeError();
404  std::vector<ModuleListStream::entry_type> Modules;
405  for (const Module &M : *ExpectedList) {
406  auto ExpectedName = File.getString(M.ModuleNameRVA);
407  if (!ExpectedName)
408  return ExpectedName.takeError();
409  auto ExpectedCv = File.getRawData(M.CvRecord);
410  if (!ExpectedCv)
411  return ExpectedCv.takeError();
412  auto ExpectedMisc = File.getRawData(M.MiscRecord);
413  if (!ExpectedMisc)
414  return ExpectedMisc.takeError();
415  Modules.push_back(
416  {M, std::move(*ExpectedName), *ExpectedCv, *ExpectedMisc});
417  }
418  return std::make_unique<ModuleListStream>(std::move(Modules));
419  }
420  case StreamKind::RawContent:
421  return std::make_unique<RawContentStream>(StreamDesc.Type,
422  File.getRawStream(StreamDesc));
423  case StreamKind::SystemInfo: {
424  auto ExpectedInfo = File.getSystemInfo();
425  if (!ExpectedInfo)
426  return ExpectedInfo.takeError();
427  auto ExpectedCSDVersion = File.getString(ExpectedInfo->CSDVersionRVA);
428  if (!ExpectedCSDVersion)
429  return ExpectedInfo.takeError();
430  return std::make_unique<SystemInfoStream>(*ExpectedInfo,
431  std::move(*ExpectedCSDVersion));
432  }
433  case StreamKind::TextContent:
434  return std::make_unique<TextContentStream>(
435  StreamDesc.Type, toStringRef(File.getRawStream(StreamDesc)));
436  case StreamKind::ThreadList: {
437  auto ExpectedList = File.getThreadList();
438  if (!ExpectedList)
439  return ExpectedList.takeError();
440  std::vector<ThreadListStream::entry_type> Threads;
441  for (const Thread &T : *ExpectedList) {
442  auto ExpectedStack = File.getRawData(T.Stack.Memory);
443  if (!ExpectedStack)
444  return ExpectedStack.takeError();
445  auto ExpectedContext = File.getRawData(T.Context);
446  if (!ExpectedContext)
447  return ExpectedContext.takeError();
448  Threads.push_back({T, *ExpectedStack, *ExpectedContext});
449  }
450  return std::make_unique<ThreadListStream>(std::move(Threads));
451  }
452  }
453  llvm_unreachable("Unhandled stream kind!");
454 }
455 
457  std::vector<std::unique_ptr<Stream>> Streams;
458  Streams.reserve(File.streams().size());
459  for (const Directory &StreamDesc : File.streams()) {
460  auto ExpectedStream = Stream::create(StreamDesc, File);
461  if (!ExpectedStream)
462  return ExpectedStream.takeError();
463  Streams.push_back(std::move(*ExpectedStream));
464  }
465  return Object(File.header(), std::move(Streams));
466 }
support::ulittle32_t FeatureInfo
Definition: Minidump.h:99
static void output(const FixedSizeString< N > &Fixed, void *, raw_ostream &OS)
SystemInfo minidump stream.
Definition: MinidumpYAML.h:121
static Expected< Object > create(const object::MinidumpFile &File)
This class represents lattice values for constants.
Definition: AllocatorList.h:23
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:65
static void mapRequiredHex(yaml::IO &IO, const char *Key, EndianType &Val)
Yaml-map an endian-aware type as an appropriately-sized hex value.
static StringRef input(StringRef Scalar, void *, FixedSizeHex< N > &Fixed)
This class provides various memory handling functions that manipulate MemoryBlock instances...
Definition: Memory.h:53
struct llvm::minidump::CPUInfo::X86Info X86
support::ulittle32_t Signature
Definition: Minidump.h:33
ProcessorArchitecture
The processor architecture of the system that generated this minidump.
Definition: Minidump.h:81
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:1165
struct llvm::minidump::CPUInfo::OtherInfo Other
detail::packed_endian_specific_integral< uint16_t, little, unaligned > ulittle16_t
Definition: Endian.h:272
static StringRef input(StringRef Scalar, void *, FixedSizeString< N > &Fixed)
ArrayRef< minidump::Directory > streams() const
Returns the list of streams (stream directory entries) in this file.
Definition: Minidump.h:35
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
std::string fromHex(StringRef Input)
Convert hexadecimal string Input to its binary representation.
Definition: StringExtras.h:170
Expected< std::string > getString(size_t Offset) const
Returns the minidump string at the given offset.
Definition: Minidump.cpp:25
detail::packed_endian_specific_integral< uint64_t, little, unaligned > ulittle64_t
Definition: Endian.h:276
support::ulittle32_t Signature
Definition: Minidump.h:136
minidump::Header Header
The minidump header.
Definition: MinidumpYAML.h:172
OSPlatform
The OS Platform of the system that generated this minidump.
Definition: Minidump.h:88
support::ulittle32_t BuildNumber
Definition: Minidump.h:124
support::ulittle64_t Flags
Definition: Minidump.h:41
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:450
StreamType
The type of a minidump stream identifies its contents.
Definition: Minidump.h:47
support::ulittle32_t ElfHWCaps
Definition: Minidump.h:104
const minidump::Header & header() const
Returns the contents of the minidump header.
Definition: Minidump.h:32
support::ulittle32_t FileOS
Definition: Minidump.h:144
Tagged union holding either a T or a Error.
Definition: yaml2obj.h:21
support::little_t< ProcessorArchitecture > ProcessorArch
Definition: Minidump.h:115
Key
PAL metadata keys.
support::ulittle32_t MajorVersion
Definition: Minidump.h:122
support::ulittle32_t VersionInfo
Definition: Minidump.h:98
Expected< const minidump::SystemInfo & > getSystemInfo() const
Returns the contents of the SystemInfo stream, cast to the appropriate type.
Definition: Minidump.h:61
Expected< ArrayRef< minidump::Module > > getModuleList() const
Returns the module list embedded in the ModuleList stream.
Definition: Minidump.h:70
LLVM_NODISCARD size_t size() const
size - Get the string size.
Definition: StringRef.h:144
static void streamMapping(yaml::IO &IO, RawContentStream &Stream)
Type(LLVMContext &C, TypeID tid)
Definition: Type.h:90
support::ulittle32_t FileSubtype
Definition: Minidump.h:146
Analysis containing CSE Info
Definition: CSEInfo.cpp:20
support::ulittle16_t SuiteMask
Definition: Minidump.h:128
static void output(const FixedSizeHex< N > &Fixed, void *, raw_ostream &OS)
The top level structure representing a minidump object, consisting of a minidump header, and zero or more streams.
Definition: MinidumpYAML.h:160
support::ulittle16_t Reserved
Definition: Minidump.h:129
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
detail::packed_endian_specific_integral< uint32_t, little, unaligned > ulittle32_t
Definition: Endian.h:274
support::ulittle64_t StartOfMemoryRange
Definition: Minidump.h:65
support::ulittle32_t AMDExtendedFeatures
Definition: Minidump.h:100
Instrumentation for Order File
static void mapRequiredAs(yaml::IO &IO, const char *Key, EndianType &Val)
Yaml-map an endian-aware type EndianType as some other type MapType.
static StreamKind getKind(minidump::StreamType Type)
Get the stream Kind used for representing streams of a given Type.
bool isHexDigit(char C)
Checks if character C is a hexadecimal numeric character.
Definition: StringExtras.h:79
Expected< ArrayRef< minidump::MemoryDescriptor > > getMemoryList() const
Returns the list of memory ranges embedded in the MemoryList stream.
Definition: Minidump.h:88
Expected< ArrayRef< uint8_t > > getRawData(minidump::LocationDescriptor Desc) const
Returns the raw contents of an object given by the LocationDescriptor.
Definition: Minidump.h:49
static QuotingType mustQuote(StringRef S)
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...
Expected< ArrayRef< minidump::Thread > > getThreadList() const
Returns the thread list embedded in the ThreadList stream.
Definition: Minidump.h:79
A stream representing a list of abstract entries in a minidump stream.
Definition: MinidumpYAML.h:59
StringRef toStringRef(bool B)
Construct a string ref from a boolean.
Definition: StringExtras.h:52
ArrayRef< uint8_t > getRawStream(const minidump::Directory &Stream) const
Returns the raw contents of the stream given by the directory entry.
Definition: Minidump.h:38
Describes a single memory range (both its VM address and where to find it in the file) of the process...
Definition: Minidump.h:64
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
struct llvm::minidump::CPUInfo::ArmInfo Arm
support::ulittle32_t FileDateLow
Definition: Minidump.h:148
ArrayRef< uint8_t >::size_type binary_size() const
The number of bytes that are represented by this BinaryRef.
Definition: YAML.h:80
support::ulittle32_t Version
Definition: Minidump.h:36
The base class for all minidump streams.
Definition: MinidumpYAML.h:27
support::ulittle16_t ProcessorRevision
Definition: Minidump.h:117
support::ulittle32_t MinorVersion
Definition: Minidump.h:123
std::vector< std::unique_ptr< Stream > > Streams
The list of streams in this minidump object.
Definition: MinidumpYAML.h:175
A minidump stream represented as a sequence of hex bytes.
Definition: MinidumpYAML.h:107
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 StringRef streamValidate(RawContentStream &Stream)
Specialized YAMLIO scalar type for representing a binary blob.
Definition: YAML.h:63
A StringRef, which is printed using YAML block notation.
Definition: MinidumpYAML.h:145
support::ulittle32_t FileFlags
Definition: Minidump.h:143
support::ulittle16_t ProcessorLevel
Definition: Minidump.h:116
support::ulittle32_t FileVersionLow
Definition: Minidump.h:139
support::little_t< OSPlatform > PlatformId
Definition: Minidump.h:125
support::ulittle32_t FileVersionHigh
Definition: Minidump.h:138
support::ulittle32_t ProductVersionLow
Definition: Minidump.h:141
#define N
Specifies the location and type of a single stream in the minidump file.
Definition: Minidump.h:73
support::ulittle32_t FileDateHigh
Definition: Minidump.h:147
support::ulittle32_t FileType
Definition: Minidump.h:145
support::ulittle32_t StructVersion
Definition: Minidump.h:137
support::ulittle32_t ProductVersionHigh
Definition: Minidump.h:140
Describes a single thread in the minidump file.
Definition: Minidump.h:172
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
std::string toHex(StringRef Input, bool LowerCase=false)
Convert buffer Input to its hexadecimal representation.
Definition: StringExtras.h:141
static QuotingType mustQuote(StringRef S)
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1217
static std::unique_ptr< Stream > create(minidump::StreamType Type)
Create an empty stream of the given Type.
A class providing access to the contents of a minidump file.
Definition: Minidump.h:22
support::ulittle32_t CPUID
Definition: Minidump.h:103
void validate(const Triple &TT, const FeatureBitset &FeatureBits)
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.
support::ulittle32_t FileFlagsMask
Definition: Minidump.h:142
support::little_t< StreamType > Type
Definition: Minidump.h:74
The SystemInfo stream, containing various information about the system where this minidump was genera...
Definition: Minidump.h:114
std::vector< entry_type > Entries
Definition: MinidumpYAML.h:62