• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- DWARFDebugPubTable.h -------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
12 
13 #include "llvm/ADT/ArrayRef.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/BinaryFormat/Dwarf.h"
16 #include <cstdint>
17 #include <vector>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 
23 /// Represents structure for holding and parsing .debug_pub* tables.
24 class DWARFDebugPubTable {
25 public:
26   struct Entry {
27     /// Section offset from the beginning of the compilation unit.
28     uint32_t SecOffset;
29 
30     /// An entry of the various gnu_pub* debug sections.
31     dwarf::PubIndexEntryDescriptor Descriptor;
32 
33     /// The name of the object as given by the DW_AT_name attribute of the
34     /// referenced DIE.
35     StringRef Name;
36   };
37 
38   /// Each table consists of sets of variable length entries. Each set describes
39   /// the names of global objects and functions, or global types, respectively,
40   /// whose definitions are represented by debugging information entries owned
41   /// by a single compilation unit.
42   struct Set {
43     /// The total length of the entries for that set, not including the length
44     /// field itself.
45     uint32_t Length;
46 
47     /// This number is specific to the name lookup table and is independent of
48     /// the DWARF version number.
49     uint16_t Version;
50 
51     /// The offset from the beginning of the .debug_info section of the
52     /// compilation unit header referenced by the set.
53     uint32_t Offset;
54 
55     /// The size in bytes of the contents of the .debug_info section generated
56     /// to represent that compilation unit.
57     uint32_t Size;
58 
59     std::vector<Entry> Entries;
60   };
61 
62 private:
63   std::vector<Set> Sets;
64 
65   /// gnu styled tables contains additional information.
66   /// This flag determines whether or not section we parse is debug_gnu* table.
67   bool GnuStyle;
68 
69 public:
70   DWARFDebugPubTable(StringRef Data, bool LittleEndian, bool GnuStyle);
71 
72   void dump(raw_ostream &OS) const;
73 
getData()74   ArrayRef<Set> getData() { return Sets; }
75 };
76 
77 } // end namespace llvm
78 
79 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGPUBTABLE_H
80