]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/ObjectYAML/CodeViewYAMLDebugSections.h
MFV r348535: 9677 panic from zio_write_gang_block() when creating dump device on...
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / ObjectYAML / CodeViewYAMLDebugSections.h
1 //=- CodeViewYAMLDebugSections.h - CodeView YAMLIO debug sections -*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines classes for handling the YAML representation of CodeView
11 // Debug Info.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
16 #define LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
17
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/DebugInfo/CodeView/CodeView.h"
21 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
22 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
23 #include "llvm/Support/Error.h"
24 #include "llvm/Support/YAMLTraits.h"
25 #include <cstdint>
26 #include <memory>
27 #include <vector>
28
29 namespace llvm {
30
31 namespace codeview {
32
33 class StringsAndChecksums;
34 class StringsAndChecksumsRef;
35
36 } // end namespace codeview
37
38 namespace CodeViewYAML {
39
40 namespace detail {
41
42 struct YAMLSubsectionBase;
43
44 } // end namespace detail
45
46 struct YAMLFrameData {
47   uint32_t RvaStart;
48   uint32_t CodeSize;
49   uint32_t LocalSize;
50   uint32_t ParamsSize;
51   uint32_t MaxStackSize;
52   StringRef FrameFunc;
53   uint32_t PrologSize;
54   uint32_t SavedRegsSize;
55   uint32_t Flags;
56 };
57
58 struct YAMLCrossModuleImport {
59   StringRef ModuleName;
60   std::vector<uint32_t> ImportIds;
61 };
62
63 struct SourceLineEntry {
64   uint32_t Offset;
65   uint32_t LineStart;
66   uint32_t EndDelta;
67   bool IsStatement;
68 };
69
70 struct SourceColumnEntry {
71   uint16_t StartColumn;
72   uint16_t EndColumn;
73 };
74
75 struct SourceLineBlock {
76   StringRef FileName;
77   std::vector<SourceLineEntry> Lines;
78   std::vector<SourceColumnEntry> Columns;
79 };
80
81 struct HexFormattedString {
82   std::vector<uint8_t> Bytes;
83 };
84
85 struct SourceFileChecksumEntry {
86   StringRef FileName;
87   codeview::FileChecksumKind Kind;
88   HexFormattedString ChecksumBytes;
89 };
90
91 struct SourceLineInfo {
92   uint32_t RelocOffset;
93   uint32_t RelocSegment;
94   codeview::LineFlags Flags;
95   uint32_t CodeSize;
96   std::vector<SourceLineBlock> Blocks;
97 };
98
99 struct InlineeSite {
100   uint32_t Inlinee;
101   StringRef FileName;
102   uint32_t SourceLineNum;
103   std::vector<StringRef> ExtraFiles;
104 };
105
106 struct InlineeInfo {
107   bool HasExtraFiles;
108   std::vector<InlineeSite> Sites;
109 };
110
111 struct YAMLDebugSubsection {
112   static Expected<YAMLDebugSubsection>
113   fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
114                         const codeview::DebugSubsectionRecord &SS);
115
116   std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
117 };
118
119 struct DebugSubsectionState {};
120
121 Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
122 toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
123                          ArrayRef<YAMLDebugSubsection> Subsections,
124                          const codeview::StringsAndChecksums &SC);
125
126 std::vector<YAMLDebugSubsection>
127 fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);
128
129 void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
130                                    codeview::StringsAndChecksums &SC);
131
132 } // end namespace CodeViewYAML
133
134 } // end namespace llvm
135
136 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::YAMLDebugSubsection)
137
138 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::YAMLDebugSubsection)
139
140 #endif // LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H