LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/DWARF - DWARFDebugRnglists.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 3 3 100.0 %
Date: 2018-05-20 00:06:23 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- DWARFDebugRnglists.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_DWARFDEBUGRNGLISTS_H
      11             : #define LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H
      12             : 
      13             : #include "llvm/DebugInfo/DIContext.h"
      14             : #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
      15             : #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
      16             : #include <cstdint>
      17             : #include <map>
      18             : #include <vector>
      19             : 
      20             : namespace llvm {
      21             : 
      22             : class Error;
      23             : class raw_ostream;
      24             : 
      25             : /// A class representing a single rangelist.
      26          14 : class DWARFDebugRnglist {
      27             : public:
      28             :   struct RangeListEntry {
      29             :     /// The offset at which the entry is located in the section.
      30             :     uint32_t Offset;
      31             :     /// The DWARF encoding (DW_RLE_*).
      32             :     uint8_t EntryKind;
      33             :     /// The values making up the range list entry. Most represent a range with
      34             :     /// a start and end address or a start address and a length. Others are
      35             :     /// single value base addresses or end-of-list with no values. The unneeded
      36             :     /// values are semantically undefined, but initialized to 0.
      37             :     uint64_t Value0;
      38             :     uint64_t Value1;
      39             : 
      40             :     Error extract(DWARFDataExtractor Data, uint32_t End, uint32_t *OffsetPtr);
      41             :   };
      42             : 
      43             :   using RngListEntries = std::vector<RangeListEntry>;
      44             : 
      45             : private:
      46             :   RngListEntries Entries;
      47             : 
      48             : public:
      49             :   const RngListEntries &getEntries() const { return Entries; }
      50             :   bool empty() const { return Entries.empty(); }
      51             :   void clear() { Entries.clear(); }
      52             :   Error extract(DWARFDataExtractor Data, uint32_t HeaderOffset, uint32_t End,
      53             :                 uint32_t *OffsetPtr);
      54             : };
      55             : 
      56             : /// A class representing a table of range lists as specified in DWARF v5.
      57             : /// The table consists of a header followed by an array of offsets into the
      58             : /// .debug_rnglists section, followed by one or more rangelists. The rangelists
      59             : /// are kept in a map where the keys are the lists' section offsets.
      60          62 : class DWARFDebugRnglistTable {
      61             : public:
      62          31 :   struct Header {
      63             :     /// The total length of the entries for this table, not including the length
      64             :     /// field itself.
      65             :     uint32_t Length = 0;
      66             :     /// The DWARF version number.
      67             :     uint16_t Version;
      68             :     /// The size in bytes of an address on the target architecture. For
      69             :     /// segmented addressing, this is the size of the offset portion of the
      70             :     /// address.
      71             :     uint8_t AddrSize;
      72             :     /// The size in bytes of a segment selector on the target architecture.
      73             :     /// If the target system uses a flat address space, this value is 0.
      74             :     uint8_t SegSize;
      75             :     /// The number of offsets that follow the header before the range lists.
      76             :     uint32_t OffsetEntryCount;
      77             :   };
      78             : 
      79             : private:
      80             :   uint32_t HeaderOffset;
      81             :   Header HeaderData;
      82             :   std::vector<uint32_t> Offsets;
      83             :   std::map<uint32_t, DWARFDebugRnglist> Ranges;
      84             : 
      85             : public:
      86             :   void clear();
      87             :   /// Extract the table header and the array of offsets.
      88             :   Error extractHeaderAndOffsets(DWARFDataExtractor Data, uint32_t *OffsetPtr);
      89             :   /// Extract an entire table, including all rangelists.
      90             :   Error extract(DWARFDataExtractor Data, uint32_t *OffsetPtr);
      91             :   uint32_t getHeaderOffset() const { return HeaderOffset; }
      92             :   void dump(raw_ostream &OS, DIDumpOptions DumpOpts) const;
      93             : 
      94             :   /// Returns the length of this table, including the length field, or 0 if the
      95             :   /// length has not been determined (e.g. because the table has not yet been
      96             :   /// parsed, or there was a problem in parsing).
      97             :   uint32_t length() const;
      98             : };
      99             : 
     100             : } // end namespace llvm
     101             : 
     102             : #endif // LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H

Generated by: LCOV version 1.13