LLVM  16.0.0git
DWARFDebugRangeList.h
Go to the documentation of this file.
1 //===- DWARFDebugRangeList.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_DWARFDEBUGRANGELIST_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
11 
13 #include <cstdint>
14 #include <vector>
15 
16 namespace llvm {
17 
18 class raw_ostream;
19 class DWARFDataExtractor;
20 namespace object {
21 struct SectionedAddress;
22 }
23 
25 public:
26  struct RangeListEntry {
27  /// A beginning address offset. This address offset has the size of an
28  /// address and is relative to the applicable base address of the
29  /// compilation unit referencing this range list. It marks the beginning
30  /// of an address range.
32  /// An ending address offset. This address offset again has the size of
33  /// an address and is relative to the applicable base address of the
34  /// compilation unit referencing this range list. It marks the first
35  /// address past the end of the address range. The ending address must
36  /// be greater than or equal to the beginning address.
38  /// A section index this range belongs to.
40 
41  /// The end of any given range list is marked by an end of list entry,
42  /// which consists of a 0 for the beginning address offset
43  /// and a 0 for the ending address offset.
44  bool isEndOfListEntry() const {
45  return (StartAddress == 0) && (EndAddress == 0);
46  }
47 
48  /// A base address selection entry consists of:
49  /// 1. The value of the largest representable address offset
50  /// (for example, 0xffffffff when the size of an address is 32 bits).
51  /// 2. An address, which defines the appropriate base address for
52  /// use in interpreting the beginning and ending address offsets of
53  /// subsequent entries of the location list.
54  bool isBaseAddressSelectionEntry(uint8_t AddressSize) const;
55  };
56 
57 private:
58  /// Offset in .debug_ranges section.
59  uint64_t Offset;
60  uint8_t AddressSize;
61  std::vector<RangeListEntry> Entries;
62 
63 public:
65 
66  void clear();
67  void dump(raw_ostream &OS) const;
68  Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr);
69  const std::vector<RangeListEntry> &getEntries() { return Entries; }
70 
71  /// getAbsoluteRanges - Returns absolute address ranges defined by this range
72  /// list. Has to be passed base address of the compile unit referencing this
73  /// range list.
76 };
77 
78 } // end namespace llvm
79 
80 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGRANGELIST_H
llvm::DWARFDebugRangeList::RangeListEntry::EndAddress
uint64_t EndAddress
An ending address offset.
Definition: DWARFDebugRangeList.h:37
llvm::DWARFDebugRangeList::RangeListEntry::isBaseAddressSelectionEntry
bool isBaseAddressSelectionEntry(uint8_t AddressSize) const
A base address selection entry consists of:
Definition: DWARFDebugRangeList.cpp:19
llvm::DWARFDebugRangeList
Definition: DWARFDebugRangeList.h:24
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DWARFDebugRangeList::clear
void clear()
Definition: DWARFDebugRangeList.cpp:25
DWARFAddressRange.h
llvm::Optional
Definition: APInt.h:33
llvm::DWARFDataExtractor
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
Definition: DWARFDataExtractor.h:21
llvm::DWARFDebugRangeList::RangeListEntry::SectionIndex
uint64_t SectionIndex
A section index this range belongs to.
Definition: DWARFDebugRangeList.h:39
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::DWARFDebugRangeList::extract
Error extract(const DWARFDataExtractor &data, uint64_t *offset_ptr)
Definition: DWARFDebugRangeList.cpp:31
object
bar al al movzbl eax ret Missed when stored in a memory object
Definition: README.txt:1411
uint64_t
llvm::DWARFDebugRangeList::RangeListEntry
Definition: DWARFDebugRangeList.h:26
llvm::DWARFDebugRangeList::getAbsoluteRanges
DWARFAddressRangesVector getAbsoluteRanges(llvm::Optional< object::SectionedAddress > BaseAddr) const
getAbsoluteRanges - Returns absolute address ranges defined by this range list.
Definition: DWARFDebugRangeList.cpp:87
llvm::DWARFAddressRangesVector
std::vector< DWARFAddressRange > DWARFAddressRangesVector
DWARFAddressRangesVector - represents a set of absolute address ranges.
Definition: DWARFAddressRange.h:88
llvm::DWARFDebugRangeList::getEntries
const std::vector< RangeListEntry > & getEntries()
Definition: DWARFDebugRangeList.h:69
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFDebugRangeList::RangeListEntry::StartAddress
uint64_t StartAddress
A beginning address offset.
Definition: DWARFDebugRangeList.h:31
llvm::DWARFDebugRangeList::RangeListEntry::isEndOfListEntry
bool isEndOfListEntry() const
The end of any given range list is marked by an end of list entry, which consists of a 0 for the begi...
Definition: DWARFDebugRangeList.h:44
llvm::DWARFDebugRangeList::DWARFDebugRangeList
DWARFDebugRangeList()
Definition: DWARFDebugRangeList.h:64
llvm::DWARFDebugRangeList::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugRangeList.cpp:67