Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:41

0001 //===- DWARFDebugPubTable.h -------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
0010 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 #include "llvm/ADT/STLFunctionalExtras.h"
0014 #include "llvm/ADT/StringRef.h"
0015 #include "llvm/BinaryFormat/Dwarf.h"
0016 #include <cstdint>
0017 #include <vector>
0018 
0019 namespace llvm {
0020 
0021 class raw_ostream;
0022 class DWARFDataExtractor;
0023 class Error;
0024 
0025 /// Represents structure for holding and parsing .debug_pub* tables.
0026 class DWARFDebugPubTable {
0027 public:
0028   struct Entry {
0029     /// Section offset from the beginning of the compilation unit.
0030     uint64_t SecOffset;
0031 
0032     /// An entry of the various gnu_pub* debug sections.
0033     dwarf::PubIndexEntryDescriptor Descriptor;
0034 
0035     /// The name of the object as given by the DW_AT_name attribute of the
0036     /// referenced DIE.
0037     StringRef Name;
0038   };
0039 
0040   /// Each table consists of sets of variable length entries. Each set describes
0041   /// the names of global objects and functions, or global types, respectively,
0042   /// whose definitions are represented by debugging information entries owned
0043   /// by a single compilation unit.
0044   struct Set {
0045     /// The total length of the entries for that set, not including the length
0046     /// field itself.
0047     uint64_t Length;
0048 
0049     /// The DWARF format of the set.
0050     dwarf::DwarfFormat Format;
0051 
0052     /// This number is specific to the name lookup table and is independent of
0053     /// the DWARF version number.
0054     uint16_t Version;
0055 
0056     /// The offset from the beginning of the .debug_info section of the
0057     /// compilation unit header referenced by the set.
0058     uint64_t Offset;
0059 
0060     /// The size in bytes of the contents of the .debug_info section generated
0061     /// to represent that compilation unit.
0062     uint64_t Size;
0063 
0064     std::vector<Entry> Entries;
0065   };
0066 
0067 private:
0068   std::vector<Set> Sets;
0069 
0070   /// gnu styled tables contains additional information.
0071   /// This flag determines whether or not section we parse is debug_gnu* table.
0072   bool GnuStyle = false;
0073 
0074 public:
0075   DWARFDebugPubTable() = default;
0076 
0077   void extract(DWARFDataExtractor Data, bool GnuStyle,
0078                function_ref<void(Error)> RecoverableErrorHandler);
0079 
0080   void dump(raw_ostream &OS) const;
0081 
0082   ArrayRef<Set> getData() { return Sets; }
0083 };
0084 
0085 } // end namespace llvm
0086 
0087 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H