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