]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / include / llvm / DebugInfo / DWARF / DWARFDebugRnglists.h
1 //===- DWARFDebugRnglists.h -------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H
10 #define LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H
11
12 #include "llvm/ADT/Optional.h"
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 class DWARFUnit;
27
28 /// A class representing a single range list entry.
29 struct RangeListEntry : public DWARFListEntryBase {
30   /// The values making up the range list entry. Most represent a range with
31   /// a start and end address or a start address and a length. Others are
32   /// single value base addresses or end-of-list with no values. The unneeded
33   /// values are semantically undefined, but initialized to 0.
34   uint64_t Value0;
35   uint64_t Value1;
36
37   Error extract(DWARFDataExtractor Data, uint32_t End, uint32_t *OffsetPtr);
38   void dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength,
39             uint64_t &CurrentBase, DIDumpOptions DumpOpts,
40             llvm::function_ref<Optional<object::SectionedAddress>(uint32_t)>
41                 LookupPooledAddress) const;
42   bool isSentinel() const { return EntryKind == dwarf::DW_RLE_end_of_list; }
43 };
44
45 /// A class representing a single rangelist.
46 class DWARFDebugRnglist : public DWARFListType<RangeListEntry> {
47 public:
48   /// Build a DWARFAddressRangesVector from a rangelist.
49   DWARFAddressRangesVector
50   getAbsoluteRanges(llvm::Optional<object::SectionedAddress> BaseAddr,
51                     DWARFUnit &U) const;
52 };
53
54 class DWARFDebugRnglistTable : public DWARFListTableBase<DWARFDebugRnglist> {
55 public:
56   DWARFDebugRnglistTable()
57       : DWARFListTableBase(/* SectionName    = */ ".debug_rnglists",
58                            /* HeaderString   = */ "ranges:",
59                            /* ListTypeString = */ "range") {}
60 };
61
62 } // end namespace llvm
63
64 #endif // LLVM_DEBUGINFO_DWARFDEBUGRNGLISTS_H