Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 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 <cstdint> |
||
17 | |||
18 | namespace llvm { |
||
19 | |||
20 | class Error; |
||
21 | class raw_ostream; |
||
22 | class DWARFUnit; |
||
23 | class DWARFDataExtractor; |
||
24 | struct DIDumpOptions; |
||
25 | namespace object { |
||
26 | struct SectionedAddress; |
||
27 | } |
||
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, uint64_t *OffsetPtr); |
||
39 | void |
||
40 | dump(raw_ostream &OS, uint8_t AddrSize, uint8_t MaxEncodingStringLength, |
||
41 | uint64_t &CurrentBase, DIDumpOptions DumpOpts, |
||
42 | llvm::function_ref<std::optional<object::SectionedAddress>(uint32_t)> |
||
43 | LookupPooledAddress) const; |
||
44 | bool isSentinel() const { return EntryKind == dwarf::DW_RLE_end_of_list; } |
||
45 | }; |
||
46 | |||
47 | /// A class representing a single rangelist. |
||
48 | class DWARFDebugRnglist : public DWARFListType<RangeListEntry> { |
||
49 | public: |
||
50 | /// Build a DWARFAddressRangesVector from a rangelist. |
||
51 | DWARFAddressRangesVector getAbsoluteRanges( |
||
52 | std::optional<object::SectionedAddress> BaseAddr, uint8_t AddressByteSize, |
||
53 | function_ref<std::optional<object::SectionedAddress>(uint32_t)> |
||
54 | LookupPooledAddress) const; |
||
55 | |||
56 | /// Build a DWARFAddressRangesVector from a rangelist. |
||
57 | DWARFAddressRangesVector |
||
58 | getAbsoluteRanges(std::optional<object::SectionedAddress> BaseAddr, |
||
59 | 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 |