DebugFrameDataSubsection.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //===- DebugFrameDataSubsection.h ------------------------------*- C++ -*-===//
  2. //
  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
  6. //
  7. //===----------------------------------------------------------------------===//
  8. #ifndef LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
  9. #define LLVM_DEBUGINFO_CODEVIEW_DEBUGFRAMEDATASUBSECTION_H
  10. #include "llvm/DebugInfo/CodeView/CodeView.h"
  11. #include "llvm/DebugInfo/CodeView/DebugSubsection.h"
  12. #include "llvm/Support/BinaryStreamReader.h"
  13. #include "llvm/Support/Endian.h"
  14. #include "llvm/Support/Error.h"
  15. namespace llvm {
  16. namespace codeview {
  17. class DebugFrameDataSubsectionRef final : public DebugSubsectionRef {
  18. public:
  19. DebugFrameDataSubsectionRef()
  20. : DebugSubsectionRef(DebugSubsectionKind::FrameData) {}
  21. static bool classof(const DebugSubsection *S) {
  22. return S->kind() == DebugSubsectionKind::FrameData;
  23. }
  24. Error initialize(BinaryStreamReader Reader);
  25. Error initialize(BinaryStreamRef Stream);
  26. FixedStreamArray<FrameData>::Iterator begin() const { return Frames.begin(); }
  27. FixedStreamArray<FrameData>::Iterator end() const { return Frames.end(); }
  28. const support::ulittle32_t *getRelocPtr() const { return RelocPtr; }
  29. private:
  30. const support::ulittle32_t *RelocPtr = nullptr;
  31. FixedStreamArray<FrameData> Frames;
  32. };
  33. class DebugFrameDataSubsection final : public DebugSubsection {
  34. public:
  35. DebugFrameDataSubsection(bool IncludeRelocPtr)
  36. : DebugSubsection(DebugSubsectionKind::FrameData),
  37. IncludeRelocPtr(IncludeRelocPtr) {}
  38. static bool classof(const DebugSubsection *S) {
  39. return S->kind() == DebugSubsectionKind::FrameData;
  40. }
  41. uint32_t calculateSerializedSize() const override;
  42. Error commit(BinaryStreamWriter &Writer) const override;
  43. void addFrameData(const FrameData &Frame);
  44. void setFrames(ArrayRef<FrameData> Frames);
  45. private:
  46. bool IncludeRelocPtr = false;
  47. std::vector<FrameData> Frames;
  48. };
  49. }
  50. }
  51. #endif