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