DebugFrameDataSubsection.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DebugFrameDataSubsection.h ------------------------------*- 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. #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
  14. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
  15. #include "llvm/DebugInfo/CodeView/CodeView.h"
  16. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  17. #include "llvm/Support/BinaryStreamArray.h"
  18. #include "llvm/Support/BinaryStreamRef.h"
  19. #include "llvm/Support/Endian.h"
  20. #include "llvm/Support/Error.h"
  21. namespace llvm {
  22. class BinaryStreamReader;
  23. class BinaryStreamWriter;
  24. namespace codeview {
  25. class DebugFrameDataSubsectionRef final : public DebugSubsectionRef {
  26. public:
  27. DebugFrameDataSubsectionRef()
  28. : DebugSubsectionRef(DebugSubsectionKind::FrameData) {}
  29. static bool classof(const DebugSubsection *S) {
  30. return S->kind() == DebugSubsectionKind::FrameData;
  31. }
  32. Error initialize(BinaryStreamReader Reader);
  33. Error initialize(BinaryStreamRef Stream);
  34. FixedStreamArray<FrameData>::Iterator begin() const { return Frames.begin(); }
  35. FixedStreamArray<FrameData>::Iterator end() const { return Frames.end(); }
  36. const support::ulittle32_t *getRelocPtr() const { return RelocPtr; }
  37. private:
  38. const support::ulittle32_t *RelocPtr = nullptr;
  39. FixedStreamArray<FrameData> Frames;
  40. };
  41. class DebugFrameDataSubsection final : public DebugSubsection {
  42. public:
  43. DebugFrameDataSubsection(bool IncludeRelocPtr)
  44. : DebugSubsection(DebugSubsectionKind::FrameData),
  45. IncludeRelocPtr(IncludeRelocPtr) {}
  46. static bool classof(const DebugSubsection *S) {
  47. return S->kind() == DebugSubsectionKind::FrameData;
  48. }
  49. uint32_t calculateSerializedSize() const override;
  50. Error commit(BinaryStreamWriter &Writer) const override;
  51. void addFrameData(const FrameData &Frame);
  52. void setFrames(ArrayRef<FrameData> Frames);
  53. private:
  54. bool IncludeRelocPtr = false;
  55. std::vector<FrameData> Frames;
  56. };
  57. }
  58. }
  59. #endif
  60. #ifdef __GNUC__
  61. #pragma GCC diagnostic pop
  62. #endif