LLVM  5.0.0
DWARFAcceleratorTable.h
Go to the documentation of this file.
1 //===- DWARFAcceleratorTable.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_DWARFACCELERATORTABLE_H
11 #define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
12 
13 #include "llvm/ADT/SmallVector.h"
17 #include <cstdint>
18 #include <utility>
19 
20 namespace llvm {
21 
22 class raw_ostream;
23 
25  struct Header {
27  uint16_t Version;
28  uint16_t HashFunction;
29  uint32_t NumBuckets;
30  uint32_t NumHashes;
31  uint32_t HeaderDataLength;
32  };
33 
34  struct HeaderData {
35  using AtomType = uint16_t;
36  using Form = dwarf::Form;
37 
38  uint32_t DIEOffsetBase;
40  };
41 
42  struct Header Hdr;
43  struct HeaderData HdrData;
44  DWARFDataExtractor AccelSection;
45  DataExtractor StringSection;
46 
47 public:
49  DataExtractor StringSection)
50  : AccelSection(AccelSection), StringSection(StringSection) {}
51 
52  bool extract();
58  bool validateForms();
59 
60  /// Return information related to the DWARF DIE we're looking for when
61  /// performing a lookup by name.
62  ///
63  /// \param HashDataOffset an offset into the hash data table
64  /// \returns DIEOffset the offset into the .debug_info section for the DIE
65  /// related to the input hash data offset. Currently this function returns
66  /// only the DIEOffset but it can be modified to return more data regarding
67  /// the DIE
68  uint32_t readAtoms(uint32_t &HashDataOffset);
69  void dump(raw_ostream &OS) const;
70 };
71 
72 } // end namespace llvm
73 
74 #endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
uint32_t readAtoms(uint32_t &HashDataOffset)
Return information related to the DWARF DIE we're looking for when performing a lookup by name...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
DWARFAcceleratorTable(const DWARFDataExtractor &AccelSection, DataExtractor StringSection)
static const char *const Magic
Definition: Archive.cpp:42
A DataExtractor (typically for an in-memory copy of an object-file section) plus a relocation map for...
ArrayRef< std::pair< HeaderData::AtomType, HeaderData::Form > > getAtomsDesc()
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
void dump(raw_ostream &OS) const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
const uint64_t Version
Definition: InstrProf.h:864