LLVM  9.0.0svn
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_DWARFDEBUGARANGESET_H
10 #define LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
11 
14 #include <cstdint>
15 #include <vector>
16 
17 namespace llvm {
18 
19 class raw_ostream;
20 
22 public:
23  struct Header {
24  /// The total length of the entries for that set, not including the length
25  /// field itself.
27  /// The offset from the beginning of the .debug_info section of the
28  /// compilation unit entry referenced by the table.
30  /// The DWARF version number.
31  uint16_t Version;
32  /// The size in bytes of an address on the target architecture. For segmented
33  /// addressing, this is the size of the offset portion of the address.
34  uint8_t AddrSize;
35  /// The size in bytes of a segment descriptor on the target architecture.
36  /// If the target system uses a flat address space, this value is 0.
37  uint8_t SegSize;
38  };
39 
40  struct Descriptor {
41  uint64_t Address;
42  uint64_t Length;
43 
44  uint64_t getEndAddress() const { return Address + Length; }
45  void dump(raw_ostream &OS, uint32_t AddressSize) const;
46  };
47 
48 private:
49  using DescriptorColl = std::vector<Descriptor>;
51 
52  uint32_t Offset;
53  Header HeaderData;
54  DescriptorColl ArangeDescriptors;
55 
56 public:
58 
59  void clear();
60  bool extract(DataExtractor data, uint32_t *offset_ptr);
61  void dump(raw_ostream &OS) const;
62 
63  uint32_t getCompileUnitDIEOffset() const { return HeaderData.CuOffset; }
64 
65  const Header &getHeader() const { return HeaderData; }
66 
68  return desc_iterator_range(ArangeDescriptors.begin(),
69  ArangeDescriptors.end());
70  }
71 };
72 
73 } // end namespace llvm
74 
75 #endif // LLVM_DEBUGINFO_DWARFDEBUGARANGESET_H
This class represents lattice values for constants.
Definition: AllocatorList.h:23
desc_iterator_range descriptors() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
uint8_t SegSize
The size in bytes of a segment descriptor on the target architecture.
uint32_t CuOffset
The offset from the beginning of the .debug_info section of the compilation unit entry referenced by ...
void dump(raw_ostream &OS) const
uint16_t Version
The DWARF version number.
uint32_t Length
The total length of the entries for that set, not including the length field itself.
bool extract(DataExtractor data, uint32_t *offset_ptr)
const Header & getHeader() const
uint8_t AddrSize
The size in bytes of an address on the target architecture.
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
uint32_t getCompileUnitDIEOffset() const