LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/DWARF - DWARFDebugArangeSet.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 3 4 75.0 %
Date: 2018-10-20 13:21:21 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- DWARFDebugArangeSet.h ------------------------------------*- 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_DWARFDEBUGARANGESET_H
      11             : #define LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
      12             : 
      13             : #include "llvm/ADT/iterator_range.h"
      14             : #include "llvm/Support/DataExtractor.h"
      15             : #include <cstdint>
      16             : #include <vector>
      17             : 
      18             : namespace llvm {
      19             : 
      20             : class raw_ostream;
      21             : 
      22             : class DWARFDebugArangeSet {
      23             : public:
      24             :   struct Header {
      25             :     /// The total length of the entries for that set, not including the length
      26             :     /// field itself.
      27             :     uint32_t Length;
      28             :     /// The offset from the beginning of the .debug_info section of the
      29             :     /// compilation unit entry referenced by the table.
      30             :     uint32_t CuOffset;
      31             :     /// The DWARF version number.
      32             :     uint16_t Version;
      33             :     /// The size in bytes of an address on the target architecture. For segmented
      34             :     /// addressing, this is the size of the offset portion of the address.
      35             :     uint8_t AddrSize;
      36             :     /// The size in bytes of a segment descriptor on the target architecture.
      37             :     /// If the target system uses a flat address space, this value is 0.
      38             :     uint8_t SegSize;
      39             :   };
      40             : 
      41             :   struct Descriptor {
      42             :     uint64_t Address;
      43             :     uint64_t Length;
      44             : 
      45       65633 :     uint64_t getEndAddress() const { return Address + Length; }
      46             :     void dump(raw_ostream &OS, uint32_t AddressSize) const;
      47             :   };
      48             : 
      49             : private:
      50             :   using DescriptorColl = std::vector<Descriptor>;
      51             :   using desc_iterator_range = iterator_range<DescriptorColl::const_iterator>;
      52             : 
      53             :   uint32_t Offset;
      54             :   Header HeaderData;
      55             :   DescriptorColl ArangeDescriptors;
      56             : 
      57             : public:
      58         234 :   DWARFDebugArangeSet() { clear(); }
      59             : 
      60             :   void clear();
      61             :   bool extract(DataExtractor data, uint32_t *offset_ptr);
      62             :   void dump(raw_ostream &OS) const;
      63             : 
      64           0 :   uint32_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; }
      65             : 
      66             :   const Header &getHeader() const { return HeaderData; }
      67             : 
      68             :   desc_iterator_range descriptors() const {
      69         968 :     return desc_iterator_range(ArangeDescriptors.begin(),
      70             :                                ArangeDescriptors.end());
      71             :   }
      72             : };
      73             : 
      74             : } // end namespace llvm
      75             : 
      76             : #endif // LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H

Generated by: LCOV version 1.13