1 //=- CodeViewYAMLDebugSections.h - CodeView YAMLIO debug sections -*- C++ -*-=//
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
7 //===----------------------------------------------------------------------===//
9 // This file defines classes for handling the YAML representation of CodeView
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
15 #define LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/DebugInfo/CodeView/CodeView.h"
20 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
21 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
22 #include "llvm/Support/Error.h"
23 #include "llvm/Support/YAMLTraits.h"
32 class StringsAndChecksums;
33 class StringsAndChecksumsRef;
35 } // end namespace codeview
37 namespace CodeViewYAML {
41 struct YAMLSubsectionBase;
43 } // end namespace detail
45 struct YAMLFrameData {
50 uint32_t MaxStackSize;
53 uint32_t SavedRegsSize;
57 struct YAMLCrossModuleImport {
59 std::vector<uint32_t> ImportIds;
62 struct SourceLineEntry {
69 struct SourceColumnEntry {
74 struct SourceLineBlock {
76 std::vector<SourceLineEntry> Lines;
77 std::vector<SourceColumnEntry> Columns;
80 struct HexFormattedString {
81 std::vector<uint8_t> Bytes;
84 struct SourceFileChecksumEntry {
86 codeview::FileChecksumKind Kind;
87 HexFormattedString ChecksumBytes;
90 struct SourceLineInfo {
92 uint32_t RelocSegment;
93 codeview::LineFlags Flags;
95 std::vector<SourceLineBlock> Blocks;
101 uint32_t SourceLineNum;
102 std::vector<StringRef> ExtraFiles;
107 std::vector<InlineeSite> Sites;
110 struct YAMLDebugSubsection {
111 static Expected<YAMLDebugSubsection>
112 fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
113 const codeview::DebugSubsectionRecord &SS);
115 std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
118 struct DebugSubsectionState {};
120 Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
121 toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
122 ArrayRef<YAMLDebugSubsection> Subsections,
123 const codeview::StringsAndChecksums &SC);
125 std::vector<YAMLDebugSubsection>
126 fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);
128 void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
129 codeview::StringsAndChecksums &SC);
131 } // end namespace CodeViewYAML
133 } // end namespace llvm
135 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::YAMLDebugSubsection)
137 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::YAMLDebugSubsection)
139 #endif // LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H