LLVM 19.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
18namespace llvm {
19
20class raw_ostream;
21class DWARFDataExtractor;
22
24public:
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
52private:
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
60public:
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
This file contains constants used for implementing Dwarf debug support.
loop extract
raw_pwrite_stream & OS
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
uint64_t getCompileUnitDIEOffset() const
const Header & getHeader() const
void dump(raw_ostream &OS) const
desc_iterator_range descriptors() const
Lightweight error class with error context and mandatory checking.
Definition: Error.h:160
An efficient, type-erasing, non-owning reference to a callable.
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:52
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:91
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void dump(raw_ostream &OS, uint32_t AddressSize) const
uint16_t Version
The DWARF version number.
uint64_t CuOffset
The offset from the beginning of the .debug_info section of the compilation unit entry referenced by ...
uint8_t AddrSize
The size in bytes of an address on the target architecture.
uint64_t Length
The total length of the entries for that set, not including the length field itself.
uint8_t SegSize
The size in bytes of a segment descriptor on the target architecture.
dwarf::DwarfFormat Format
The DWARF format of the set.