CodeViewYAMLDebugSections.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //=- CodeViewYAMLDebugSections.h - CodeView YAMLIO debug sections -*- C++ -*-=//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines classes for handling the YAML representation of CodeView
  15. // Debug Info.
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
  19. #define LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
  20. #include "llvm/ADT/ArrayRef.h"
  21. #include "llvm/ADT/StringRef.h"
  22. #include "llvm/DebugInfo/CodeView/CodeView.h"
  23. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  24. #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
  25. #include "llvm/Support/Error.h"
  26. #include "llvm/Support/YAMLTraits.h"
  27. #include <cstdint>
  28. #include <memory>
  29. #include <vector>
  30. namespace llvm {
  31. namespace codeview {
  32. class StringsAndChecksums;
  33. class StringsAndChecksumsRef;
  34. } // end namespace codeview
  35. namespace CodeViewYAML {
  36. namespace detail {
  37. struct YAMLSubsectionBase;
  38. } // end namespace detail
  39. struct YAMLFrameData {
  40. uint32_t RvaStart;
  41. uint32_t CodeSize;
  42. uint32_t LocalSize;
  43. uint32_t ParamsSize;
  44. uint32_t MaxStackSize;
  45. StringRef FrameFunc;
  46. uint32_t PrologSize;
  47. uint32_t SavedRegsSize;
  48. uint32_t Flags;
  49. };
  50. struct YAMLCrossModuleImport {
  51. StringRef ModuleName;
  52. std::vector<uint32_t> ImportIds;
  53. };
  54. struct SourceLineEntry {
  55. uint32_t Offset;
  56. uint32_t LineStart;
  57. uint32_t EndDelta;
  58. bool IsStatement;
  59. };
  60. struct SourceColumnEntry {
  61. uint16_t StartColumn;
  62. uint16_t EndColumn;
  63. };
  64. struct SourceLineBlock {
  65. StringRef FileName;
  66. std::vector<SourceLineEntry> Lines;
  67. std::vector<SourceColumnEntry> Columns;
  68. };
  69. struct HexFormattedString {
  70. std::vector<uint8_t> Bytes;
  71. };
  72. struct SourceFileChecksumEntry {
  73. StringRef FileName;
  74. codeview::FileChecksumKind Kind;
  75. HexFormattedString ChecksumBytes;
  76. };
  77. struct SourceLineInfo {
  78. uint32_t RelocOffset;
  79. uint32_t RelocSegment;
  80. codeview::LineFlags Flags;
  81. uint32_t CodeSize;
  82. std::vector<SourceLineBlock> Blocks;
  83. };
  84. struct InlineeSite {
  85. uint32_t Inlinee;
  86. StringRef FileName;
  87. uint32_t SourceLineNum;
  88. std::vector<StringRef> ExtraFiles;
  89. };
  90. struct InlineeInfo {
  91. bool HasExtraFiles;
  92. std::vector<InlineeSite> Sites;
  93. };
  94. struct YAMLDebugSubsection {
  95. static Expected<YAMLDebugSubsection>
  96. fromCodeViewSubection(const codeview::StringsAndChecksumsRef &SC,
  97. const codeview::DebugSubsectionRecord &SS);
  98. std::shared_ptr<detail::YAMLSubsectionBase> Subsection;
  99. };
  100. struct DebugSubsectionState {};
  101. Expected<std::vector<std::shared_ptr<codeview::DebugSubsection>>>
  102. toCodeViewSubsectionList(BumpPtrAllocator &Allocator,
  103. ArrayRef<YAMLDebugSubsection> Subsections,
  104. const codeview::StringsAndChecksums &SC);
  105. std::vector<YAMLDebugSubsection>
  106. fromDebugS(ArrayRef<uint8_t> Data, const codeview::StringsAndChecksumsRef &SC);
  107. void initializeStringsAndChecksums(ArrayRef<YAMLDebugSubsection> Sections,
  108. codeview::StringsAndChecksums &SC);
  109. } // end namespace CodeViewYAML
  110. } // end namespace llvm
  111. LLVM_YAML_DECLARE_MAPPING_TRAITS(CodeViewYAML::YAMLDebugSubsection)
  112. LLVM_YAML_IS_SEQUENCE_VECTOR(CodeViewYAML::YAMLDebugSubsection)
  113. #endif // LLVM_OBJECTYAML_CODEVIEWYAMLDEBUGSECTIONS_H
  114. #ifdef __GNUC__
  115. #pragma GCC diagnostic pop
  116. #endif