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