• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- DWARFGdbIndex.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_DWARFGDBINDEX_H
11 #define LLVM_DEBUGINFO_DWARF_DWARFGDBINDEX_H
12 
13 #include "llvm/ADT/SmallVector.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/DataExtractor.h"
16 #include <cstdint>
17 #include <utility>
18 
19 namespace llvm {
20 
21 class raw_ostream;
22 
23 class DWARFGdbIndex {
24   uint32_t Version;
25 
26   uint32_t CuListOffset;
27   uint32_t AddressAreaOffset;
28   uint32_t SymbolTableOffset;
29   uint32_t ConstantPoolOffset;
30 
31   struct CompUnitEntry {
32     uint64_t Offset; /// Offset of a CU in the .debug_info section.
33     uint64_t Length; /// Length of that CU.
34   };
35   SmallVector<CompUnitEntry, 0> CuList;
36 
37   struct AddressEntry {
38     uint64_t LowAddress;  /// The low address.
39     uint64_t HighAddress; /// The high address.
40     uint32_t CuIndex;     /// The CU index.
41   };
42   SmallVector<AddressEntry, 0> AddressArea;
43 
44   struct SymTableEntry {
45     uint32_t NameOffset; /// Offset of the symbol's name in the constant pool.
46     uint32_t VecOffset;  /// Offset of the CU vector in the constant pool.
47   };
48   SmallVector<SymTableEntry, 0> SymbolTable;
49 
50   /// Each value is CU index + attributes.
51   SmallVector<std::pair<uint32_t, SmallVector<uint32_t, 0>>, 0>
52       ConstantPoolVectors;
53 
54   StringRef ConstantPoolStrings;
55   uint32_t StringPoolOffset;
56 
57   void dumpCUList(raw_ostream &OS) const;
58   void dumpAddressArea(raw_ostream &OS) const;
59   void dumpSymbolTable(raw_ostream &OS) const;
60   void dumpConstantPool(raw_ostream &OS) const;
61 
62   bool parseImpl(DataExtractor Data);
63 
64 public:
65   void dump(raw_ostream &OS);
66   void parse(DataExtractor Data);
67 
68   bool HasContent = false;
69   bool HasError = false;
70 };
71 
72 } // end namespace llvm
73 
74 #endif // LLVM_DEBUGINFO_DWARF_DWARFGDBINDEX_H
75