Home | History | Annotate | Download | only in DWARF
      1 //===- DWARFDebugFrame.h - Parsing of .debug_frame --------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H
     11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H
     12 
     13 #include "llvm/Support/DataExtractor.h"
     14 #include <memory>
     15 #include <vector>
     16 
     17 namespace llvm {
     18 
     19 class FrameEntry;
     20 class raw_ostream;
     21 
     22 /// \brief A parsed .debug_frame or .eh_frame section
     23 ///
     24 class DWARFDebugFrame {
     25   // True if this is parsing an eh_frame section.
     26   bool IsEH;
     27 
     28 public:
     29   DWARFDebugFrame(bool IsEH);
     30   ~DWARFDebugFrame();
     31 
     32   /// Dump the section data into the given stream.
     33   void dump(raw_ostream &OS, Optional<uint64_t> Offset) const;
     34 
     35   /// \brief Parse the section from raw data.
     36   /// data is assumed to be pointing to the beginning of the section.
     37   void parse(DataExtractor Data);
     38 
     39   /// Return whether the section has any entries.
     40   bool empty() const { return Entries.empty(); }
     41 
     42   /// Return the entry at the given offset or nullptr.
     43   FrameEntry *getEntryAtOffset(uint64_t Offset) const;
     44 
     45 private:
     46   std::vector<std::unique_ptr<FrameEntry>> Entries;
     47 };
     48 
     49 } // end namespace llvm
     50 
     51 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGFRAME_H
     52