LLVM  16.0.0git
DWARFDebugArangeSet.h
Go to the documentation of this file.
1 //===- DWARFDebugArangeSet.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_DWARFDEBUGARANGESET_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGARANGESET_H
11 
14 #include "llvm/Support/Error.h"
15 #include <cstdint>
16 #include <vector>
17 
18 namespace llvm {
19 
20 class raw_ostream;
21 class DWARFDataExtractor;
22 
24 public:
25  struct Header {
26  /// The total length of the entries for that set, not including the length
27  /// field itself.
29  /// The DWARF format of the set.
31  /// The offset from the beginning of the .debug_info section of the
32  /// compilation unit entry referenced by the table.
34  /// The DWARF version number.
36  /// The size in bytes of an address on the target architecture. For segmented
37  /// addressing, this is the size of the offset portion of the address.
38  uint8_t AddrSize;
39  /// The size in bytes of a segment descriptor on the target architecture.
40  /// If the target system uses a flat address space, this value is 0.
41  uint8_t SegSize;
42  };
43 
44  struct Descriptor {
47 
48  uint64_t getEndAddress() const { return Address + Length; }
49  void dump(raw_ostream &OS, uint32_t AddressSize) const;
50  };
51 
52 private:
53  using DescriptorColl = std::vector<Descriptor>;
54  using desc_iterator_range = iterator_range<DescriptorColl::const_iterator>;
55 
56  uint64_t Offset;
57  Header HeaderData;
58  DescriptorColl ArangeDescriptors;
59 
60 public:
62 
63  void clear();
64  Error extract(DWARFDataExtractor data, uint64_t *offset_ptr,
65  function_ref<void(Error)> WarningHandler);
66  void dump(raw_ostream &OS) const;
67 
68  uint64_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; }
69 
70  const Header &getHeader() const { return HeaderData; }
71 
73  return desc_iterator_range(ArangeDescriptors.begin(),
74  ArangeDescriptors.end());
75  }
76 };
77 
78 } // end namespace llvm
79 
80 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGARANGESET_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DWARFDebugArangeSet::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugArangeSet.cpp:163
llvm::DWARFDebugArangeSet::clear
void clear()
Definition: DWARFDebugArangeSet.cpp:32
llvm::DWARFDebugArangeSet::Descriptor::Address
uint64_t Address
Definition: DWARFDebugArangeSet.h:45
llvm::DWARFDebugArangeSet::Header::AddrSize
uint8_t AddrSize
The size in bytes of an address on the target architecture.
Definition: DWARFDebugArangeSet.h:38
Error.h
llvm::DWARFDebugArangeSet::Header
Definition: DWARFDebugArangeSet.h:25
llvm::DWARFDebugArangeSet::Descriptor::Length
uint64_t Length
Definition: DWARFDebugArangeSet.h:46
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::DWARFDebugArangeSet::Header::CuOffset
uint64_t CuOffset
The offset from the beginning of the .debug_info section of the compilation unit entry referenced by ...
Definition: DWARFDebugArangeSet.h:33
llvm::DWARFDebugArangeSet::descriptors
desc_iterator_range descriptors() const
Definition: DWARFDebugArangeSet.h:72
llvm::DWARFDebugArangeSet::Descriptor::getEndAddress
uint64_t getEndAddress() const
Definition: DWARFDebugArangeSet.h:48
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::dwarf::DwarfFormat
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:93
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
uint64_t
llvm::DWARFDebugArangeSet::getHeader
const Header & getHeader() const
Definition: DWARFDebugArangeSet.h:70
llvm::DWARFDebugArangeSet
Definition: DWARFDebugArangeSet.h:23
iterator_range.h
llvm::DWARFDebugArangeSet::Descriptor
Definition: DWARFDebugArangeSet.h:44
Dwarf.h
uint32_t
llvm::DWARFDebugArangeSet::getCompileUnitDIEOffset
uint64_t getCompileUnitDIEOffset() const
Definition: DWARFDebugArangeSet.h:68
llvm::DWARFDebugArangeSet::extract
Error extract(DWARFDataExtractor data, uint64_t *offset_ptr, function_ref< void(Error)> WarningHandler)
Definition: DWARFDebugArangeSet.cpp:38
llvm::DWARFDebugArangeSet::Descriptor::dump
void dump(raw_ostream &OS, uint32_t AddressSize) const
Definition: DWARFDebugArangeSet.cpp:23
llvm::DWARFDebugArangeSet::Header::SegSize
uint8_t SegSize
The size in bytes of a segment descriptor on the target architecture.
Definition: DWARFDebugArangeSet.h:41
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFDebugArangeSet::Header::Format
dwarf::DwarfFormat Format
The DWARF format of the set.
Definition: DWARFDebugArangeSet.h:30
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::DWARFDebugArangeSet::Header::Length
uint64_t Length
The total length of the entries for that set, not including the length field itself.
Definition: DWARFDebugArangeSet.h:28
llvm::DWARFDebugArangeSet::Header::Version
uint16_t Version
The DWARF version number.
Definition: DWARFDebugArangeSet.h:35
llvm::DWARFDebugArangeSet::DWARFDebugArangeSet
DWARFDebugArangeSet()
Definition: DWARFDebugArangeSet.h:61