1 //===-- DWARFDebugAranges.h -------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_DWARFDEBUGARANGES_H
11 #define LLVM_DEBUGINFO_DWARFDEBUGARANGES_H
13 #include "DWARFDebugArangeSet.h"
14 #include "llvm/ADT/DenseSet.h"
21 class DWARFDebugAranges {
24 explicit Range(uint64_t lo = -1ULL, uint64_t hi = -1ULL,
26 : LoPC(lo), Length(hi-lo), Offset(off) {}
34 void setHiPC(uint64_t HiPC) {
35 if (HiPC == -1ULL || HiPC <= LoPC)
40 uint64_t HiPC() const {
45 bool isValidRange() const { return Length > 0; }
47 static bool SortedOverlapCheck(const Range &curr_range,
48 const Range &next_range, uint32_t n) {
49 if (curr_range.Offset != next_range.Offset)
51 return curr_range.HiPC() + n >= next_range.LoPC;
54 bool contains(const Range &range) const {
55 return LoPC <= range.LoPC && range.HiPC() <= HiPC();
58 void dump(raw_ostream &OS) const;
59 uint64_t LoPC; // Start of address range
60 uint32_t Length; // End of address range (not including this address)
61 uint32_t Offset; // Offset of the compile unit or die
66 ParsedCUOffsets.clear();
68 void extract(DataExtractor DebugArangesData);
69 void generate(DWARFContext *CTX);
71 // Use appendRange multiple times and then call sort.
72 void appendRange(uint32_t CUOffset, uint64_t LowPC, uint64_t HighPC);
73 void sort(bool Minimize, uint32_t OverlapSize);
75 void dump(raw_ostream &OS) const;
76 uint32_t findAddress(uint64_t Address) const;
78 typedef std::vector<Range> RangeColl;
79 typedef RangeColl::const_iterator RangeCollIterator;
80 typedef DenseSet<uint32_t> ParsedCUOffsetColl;
84 ParsedCUOffsetColl ParsedCUOffsets;