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/ADT/Optional.h" 14 #include "llvm/BinaryFormat/Dwarf.h" 15 #include "llvm/DebugInfo/DIContext.h" 16 #include "llvm/DebugInfo/DWARF/DWARFDataExtractor.h" 17 #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" 18 #include "llvm/DebugInfo/DWARF/DWARFListTable.h" 19 #include <cstdint> 20 #include <map> 21 #include <vector> 22 23 namespace llvm { 24 25 class Error; 26 class raw_ostream; 27 class DWARFUnit; 28 29 /// A class representing a single range list entry. 30 struct RangeListEntry : public DWARFListEntryBase { 31 /// The values making up the range list entry. Most represent a range with 32 /// a start and end address or a start address and a length. Others are 33 /// single value base addresses or end-of-list with no values. The unneeded 34 /// values are semantically undefined, but initialized to 0. 35 uint64_t Value0; 36 uint64_t Value1; 37 38 Error extract(DWARFDataExtractor Data, uint32_t End, uint32_t *OffsetPtr); 39 void dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength, 40 uint64_t &CurrentBase, DIDumpOptions DumpOpts, 41 llvm::function_ref<Optional<SectionedAddress>(uint32_t)> 42 LookupPooledAddress) const; isSentinelRangeListEntry43 bool isSentinel() const { return EntryKind == dwarf::DW_RLE_end_of_list; } 44 }; 45 46 /// A class representing a single rangelist. 47 class DWARFDebugRnglist : public DWARFListType<RangeListEntry> { 48 public: 49 /// Build a DWARFAddressRangesVector from a rangelist. 50 DWARFAddressRangesVector 51 getAbsoluteRanges(llvm::Optional<SectionedAddress> BaseAddr, 52 DWARFUnit &U) const; 53 }; 54 55 class DWARFDebugRnglistTable : public DWARFListTableBase<DWARFDebugRnglist> { 56 public: DWARFDebugRnglistTable()57 DWARFDebugRnglistTable() 58 : DWARFListTableBase(/* SectionName = */ ".debug_rnglists", 59 /* HeaderString = */ "ranges:", 60 /* ListTypeString = */ "range") {} 61 }; 62 63 } // end namespace llvm 64 65 #endif // LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H 66