LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/DWARF - DWARFDebugRangeList.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 6 6 100.0 %
Date: 2017-09-14 15:23:50 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- DWARFDebugRangeList.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_DWARF_DWARFDEBUGRANGELIST_H
      11             : #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
      12             : 
      13             : #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
      14             : #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
      15             : #include <cassert>
      16             : #include <cstdint>
      17             : #include <vector>
      18             : 
      19             : namespace llvm {
      20             : 
      21             : struct BaseAddress;
      22             : class raw_ostream;
      23             : 
      24             : struct DWARFAddressRange {
      25             :   uint64_t LowPC;
      26             :   uint64_t HighPC;
      27             :   uint64_t SectionIndex;
      28             : };
      29             : 
      30             : /// DWARFAddressRangesVector - represents a set of absolute address ranges.
      31             : using DWARFAddressRangesVector = std::vector<DWARFAddressRange>;
      32             : 
      33      230308 : class DWARFDebugRangeList {
      34             : public:
      35             :   struct RangeListEntry {
      36             :     /// A beginning address offset. This address offset has the size of an
      37             :     /// address and is relative to the applicable base address of the
      38             :     /// compilation unit referencing this range list. It marks the beginning
      39             :     /// of an address range.
      40             :     uint64_t StartAddress;
      41             :     /// An ending address offset. This address offset again has the size of
      42             :     /// an address and is relative to the applicable base address of the
      43             :     /// compilation unit referencing this range list. It marks the first
      44             :     /// address past the end of the address range. The ending address must
      45             :     /// be greater than or equal to the beginning address.
      46             :     uint64_t EndAddress;
      47             :     /// A section index this range belongs to.
      48             :     uint64_t SectionIndex;
      49             : 
      50             :     /// The end of any given range list is marked by an end of list entry,
      51             :     /// which consists of a 0 for the beginning address offset
      52             :     /// and a 0 for the ending address offset.
      53             :     bool isEndOfListEntry() const {
      54     1897188 :       return (StartAddress == 0) && (EndAddress == 0);
      55             :     }
      56             : 
      57             :     /// A base address selection entry consists of:
      58             :     /// 1. The value of the largest representable address offset
      59             :     /// (for example, 0xffffffff when the size of an address is 32 bits).
      60             :     /// 2. An address, which defines the appropriate base address for
      61             :     /// use in interpreting the beginning and ending address offsets of
      62             :     /// subsequent entries of the location list.
      63             :     bool isBaseAddressSelectionEntry(uint8_t AddressSize) const {
      64             :       assert(AddressSize == 4 || AddressSize == 8);
      65     1782190 :       if (AddressSize == 4)
      66          30 :         return StartAddress == -1U;
      67             :       else
      68     1782160 :         return StartAddress == -1ULL;
      69             :     }
      70             :   };
      71             : 
      72             : private:
      73             :   /// Offset in .debug_ranges section.
      74             :   uint32_t Offset;
      75             :   uint8_t AddressSize;
      76             :   std::vector<RangeListEntry> Entries;
      77             : 
      78             : public:
      79      230310 :   DWARFDebugRangeList() { clear(); }
      80             : 
      81             :   void clear();
      82             :   void dump(raw_ostream &OS) const;
      83             :   bool extract(const DWARFDataExtractor &data, uint32_t *offset_ptr);
      84             :   const std::vector<RangeListEntry> &getEntries() { return Entries; }
      85             : 
      86             :   /// getAbsoluteRanges - Returns absolute address ranges defined by this range
      87             :   /// list. Has to be passed base address of the compile unit referencing this
      88             :   /// range list.
      89             :   DWARFAddressRangesVector
      90             :   getAbsoluteRanges(llvm::Optional<BaseAddress> BaseAddr) const;
      91             : };
      92             : 
      93             : } // end namespace llvm
      94             : 
      95             : #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H

Generated by: LCOV version 1.13