LLVM  16.0.0git
DWARFDebugPubTable.h
Go to the documentation of this file.
1 //===- DWARFDebugPubTable.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_DWARFDEBUGPUBTABLE_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
11 
12 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
16 #include <cstdint>
17 #include <vector>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 class DWARFDataExtractor;
23 class Error;
24 
25 /// Represents structure for holding and parsing .debug_pub* tables.
27 public:
28  struct Entry {
29  /// Section offset from the beginning of the compilation unit.
31 
32  /// An entry of the various gnu_pub* debug sections.
34 
35  /// The name of the object as given by the DW_AT_name attribute of the
36  /// referenced DIE.
38  };
39 
40  /// Each table consists of sets of variable length entries. Each set describes
41  /// the names of global objects and functions, or global types, respectively,
42  /// whose definitions are represented by debugging information entries owned
43  /// by a single compilation unit.
44  struct Set {
45  /// The total length of the entries for that set, not including the length
46  /// field itself.
48 
49  /// The DWARF format of the set.
51 
52  /// This number is specific to the name lookup table and is independent of
53  /// the DWARF version number.
55 
56  /// The offset from the beginning of the .debug_info section of the
57  /// compilation unit header referenced by the set.
59 
60  /// The size in bytes of the contents of the .debug_info section generated
61  /// to represent that compilation unit.
63 
64  std::vector<Entry> Entries;
65  };
66 
67 private:
68  std::vector<Set> Sets;
69 
70  /// gnu styled tables contains additional information.
71  /// This flag determines whether or not section we parse is debug_gnu* table.
72  bool GnuStyle = false;
73 
74 public:
75  DWARFDebugPubTable() = default;
76 
77  void extract(DWARFDataExtractor Data, bool GnuStyle,
78  function_ref<void(Error)> RecoverableErrorHandler);
79 
80  void dump(raw_ostream &OS) const;
81 
82  ArrayRef<Set> getData() { return Sets; }
83 };
84 
85 } // end namespace llvm
86 
87 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::DWARFDebugPubTable::Set
Each table consists of sets of variable length entries.
Definition: DWARFDebugPubTable.h:44
llvm::DWARFDebugPubTable::Set::Entries
std::vector< Entry > Entries
Definition: DWARFDebugPubTable.h:64
llvm::lltok::Error
@ Error
Definition: LLToken.h:21
llvm::DWARFDebugPubTable::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugPubTable.cpp:93
StringRef.h
llvm::DWARFDebugPubTable::Entry::Descriptor
dwarf::PubIndexEntryDescriptor Descriptor
An entry of the various gnu_pub* debug sections.
Definition: DWARFDebugPubTable.h:33
llvm::DWARFDebugPubTable::Entry
Definition: DWARFDebugPubTable.h:28
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::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DWARFDebugPubTable::Set::Offset
uint64_t Offset
The offset from the beginning of the .debug_info section of the compilation unit header referenced by...
Definition: DWARFDebugPubTable.h:58
llvm::DWARFDebugPubTable::DWARFDebugPubTable
DWARFDebugPubTable()=default
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
STLFunctionalExtras.h
llvm::DWARFDebugPubTable::getData
ArrayRef< Set > getData()
Definition: DWARFDebugPubTable.h:82
llvm::dwarf::DwarfFormat
DwarfFormat
Constants that define the DWARF format as 32 or 64 bit.
Definition: Dwarf.h:93
llvm::DWARFDebugPubTable::Set::Length
uint64_t Length
The total length of the entries for that set, not including the length field itself.
Definition: DWARFDebugPubTable.h:47
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition: STLFunctionalExtras.h:36
uint64_t
llvm::DWARFDebugPubTable::Entry::Name
StringRef Name
The name of the object as given by the DW_AT_name attribute of the referenced DIE.
Definition: DWARFDebugPubTable.h:37
ArrayRef.h
llvm::DWARFDebugPubTable::Set::Size
uint64_t Size
The size in bytes of the contents of the .debug_info section generated to represent that compilation ...
Definition: DWARFDebugPubTable.h:62
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Dwarf.h
llvm::DWARFDebugPubTable::Entry::SecOffset
uint64_t SecOffset
Section offset from the beginning of the compilation unit.
Definition: DWARFDebugPubTable.h:30
llvm::DWARFDebugPubTable
Represents structure for holding and parsing .debug_pub* tables.
Definition: DWARFDebugPubTable.h:26
uint16_t
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:155
llvm::DWARFDebugPubTable::extract
void extract(DWARFDataExtractor Data, bool GnuStyle, function_ref< void(Error)> RecoverableErrorHandler)
Definition: DWARFDebugPubTable.cpp:22
llvm::dwarf::PubIndexEntryDescriptor
Describes an entry of the various gnu_pub* debug sections.
Definition: Dwarf.h:723
llvm::DWARFDebugPubTable::Set::Version
uint16_t Version
This number is specific to the name lookup table and is independent of the DWARF version number.
Definition: DWARFDebugPubTable.h:54
llvm::DWARFDebugPubTable::Set::Format
dwarf::DwarfFormat Format
The DWARF format of the set.
Definition: DWARFDebugPubTable.h:50