Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:21

0001 //=- CodeViewYAMLDebugSections.h - CodeView YAMLIO debug sections -*- C++ -*-=//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file defines classes for handling the YAML representation of CodeView
0010 // Debug Info.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
0015 #define LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
0016 
0017 #include "llvm/ADT/ArrayRef.h"
0018 #include "llvm/ADT/StringRef.h"
0019 #include "llvm/DebugInfo/CodeView/CodeView.h"
0020 #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
0021 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
0022 #include "llvm/Support/Error.h"
0023 #include "llvm/Support/YAMLTraits.h"
0024 #include <cstdint>
0025 #include <memory>
0026 #include <vector>
0027 
0028 namespace llvm {
0029 
0030 namespace codeview {
0031 
0032 class StringsAndChecksums;
0033 class StringsAndChecksumsRef;
0034 
0035 } // end namespace codeview
0036 
0037 namespace CodeViewYAML {
0038 
0039 namespace detail {
0040 
0041 struct YAMLSubsectionBase;
0042 
0043 } // end namespace detail
0044 
0045 struct YAMLFrameData {
0046   uint32_t RvaStart;
0047   uint32_t CodeSize;
0048   uint32_t LocalSize;
0049   uint32_t ParamsSize;
0050   uint32_t MaxStackSize;
0051   StringRef FrameFunc;
0052   uint32_t PrologSize;
0053   uint32_t SavedRegsSize;
0054   uint32_t Flags;
0055 };
0056 
0057 struct YAMLCrossModuleImport {
0058   StringRef ModuleName;
0059   std::vector<uint32_t> ImportIds;
0060 };
0061 
0062 struct SourceLineEntry {
0063   uint32_t Offset;
0064   uint32_t LineStart;
0065   uint32_t EndDelta;
0066   bool IsStatement;
0067 };
0068 
0069 struct SourceColumnEntry {
0070   uint16_t StartColumn;
0071   uint16_t EndColumn;
0072 };
0073 
0074 struct SourceLineBlock {
0075   StringRef FileName;
0076   std::vector<SourceLineEntry> Lines;
0077   std::vector<SourceColumnEntry> Columns;
0078 };
0079 
0080 struct HexFormattedString {
0081   std::vector<uint8_t> Bytes;
0082 };
0083 
0084 struct SourceFileChecksumEntry {
0085   StringRef FileName;
0086   codeview::FileChecksumKind Kind;
0087   HexFormattedString ChecksumBytes;
0088 };
0089 
0090 struct SourceLineInfo {
0091   uint32_t RelocOffset;
0092   uint32_t RelocSegment;
0093   codeview::LineFlags Flags;
0094   uint32_t CodeSize;
0095   std::vector<SourceLineBlock> Blocks;
0096 };
0097 
0098 struct InlineeSite {
0099   uint32_t Inlinee;
0100   StringRef FileName;
0101   uint32_t SourceLineNum;
0102   std::vector<StringRef> ExtraFiles;
0103 };
0104 
0105 struct InlineeInfo {
0106   bool HasExtraFiles;
0107   std::vector<InlineeSite> Sites;
0108 };
0109 
0110 struct YAMLDebugSubsection {
0111   static Expected<YAMLDebugSubsection>
0112   fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
0113                         const codeview::DebugSubsectionRecord &SS);
0114 
0115   std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
0116 };
0117 
0118 Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
0119 toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
0120                          ArrayRef<YAMLDebugSubsection> Subsections,
0121                          const codeview::StringsAndChecksums &SC);
0122 
0123 std::vector<YAMLDebugSubsection>
0124 fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);
0125 
0126 void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
0127                                    codeview::StringsAndChecksums &SC);
0128 
0129 } // end namespace CodeViewYAML
0130 
0131 } // end namespace llvm
0132 
0133 LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::YAMLDebugSubsection)
0134 
0135 LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::YAMLDebugSubsection)
0136 
0137 #endif // LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H