LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/DWARF - DWARFDebugLoc.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             : //===- DWARFDebugLoc.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_DWARFDEBUGLOC_H
      11             : #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H
      12             : 
      13             : #include "llvm/ADT/Optional.h"
      14             : #include "llvm/ADT/SmallVector.h"
      15             : #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h"
      16             : #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
      17             : #include <cstdint>
      18             : 
      19             : namespace llvm {
      20             : class DWARFUnit;
      21             : class MCRegisterInfo;
      22             : class raw_ostream;
      23             : 
      24        1264 : class DWARFDebugLoc {
      25             : public:
      26             :   /// A single location within a location list.
      27        4671 :   struct Entry {
      28             :     /// The beginning address of the instruction range.
      29             :     uint64_t Begin;
      30             :     /// The ending address of the instruction range.
      31             :     uint64_t End;
      32             :     /// The location of the variable within the specified range.
      33             :     SmallVector<char, 4> Loc;
      34             :   };
      35             : 
      36             :   /// A list of locations that contain one variable.
      37        1810 :   struct LocationList {
      38             :     /// The beginning offset where this location list is stored in the debug_loc
      39             :     /// section.
      40             :     unsigned Offset;
      41             :     /// All the locations in which the variable is stored.
      42             :     SmallVector<Entry, 2> Entries;
      43             :     /// Dump this list on OS.
      44             :     void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
      45             :               const MCRegisterInfo *MRI, unsigned Indent) const;
      46             :   };
      47             : 
      48             : private:
      49             :   using LocationLists = SmallVector<LocationList, 4>;
      50             : 
      51             :   /// A list of all the variables in the debug_loc section, each one describing
      52             :   /// the locations in which the variable is stored.
      53             :   LocationLists Locations;
      54             : 
      55             :   unsigned AddressSize;
      56             : 
      57             :   bool IsLittleEndian;
      58             : 
      59             : public:
      60             :   /// Print the location lists found within the debug_loc section.
      61             :   void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
      62             : 
      63             :   /// Parse the debug_loc section accessible via the 'data' parameter using the
      64             :   /// address size also given in 'data' to interpret the address ranges.
      65             :   void parse(const DWARFDataExtractor &data);
      66             : 
      67             :   Optional<LocationList> parseOneLocationList(DWARFDataExtractor Data,
      68             :                                               uint32_t *Offset);
      69             : };
      70             : 
      71         664 : class DWARFDebugLocDWO {
      72             : public:
      73         161 :   struct Entry {
      74             :     uint64_t Start;
      75             :     uint32_t Length;
      76             :     SmallVector<char, 4> Loc;
      77             :   };
      78             : 
      79          85 :   struct LocationList {
      80             :     unsigned Offset;
      81             :     SmallVector<Entry, 2> Entries;
      82             :     void dump(raw_ostream &OS, bool IsLittleEndian, unsigned AddressSize,
      83             :               const MCRegisterInfo *RegInfo, unsigned Indent) const;
      84             :   };
      85             : 
      86             : private:
      87             :   using LocationLists = SmallVector<LocationList, 4>;
      88             : 
      89             :   LocationLists Locations;
      90             : 
      91             :   unsigned AddressSize;
      92             : 
      93             :   bool IsLittleEndian;
      94             : 
      95             : public:
      96             :   void parse(DataExtractor data);
      97             :   void dump(raw_ostream &OS, const MCRegisterInfo *RegInfo) const;
      98             : 
      99             :   static Optional<LocationList> parseOneLocationList(DataExtractor Data,
     100             :                                                      uint32_t *Offset);
     101             : };
     102             : 
     103             : } // end namespace llvm
     104             : 
     105             : #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGLOC_H

Generated by: LCOV version 1.13