DebugFrameDataSubsection.h 2.2 KB

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