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" 14#include "llvm/BinaryFormat/Dwarf.h" 15#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" 16#include "llvm/Support/DataExtractor.h" 17#include <cstdint> 18#include <utility> 19 20namespace llvm { 21 22class raw_ostream; 23 24class DWARFAcceleratorTable { 25 struct Header { 26 uint32_t Magic; 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 typedef uint16_t AtomType; 36 typedef dwarf::Form Form; 37 uint32_t DIEOffsetBase; 38 SmallVector<std::pair<AtomType, Form>, 3> Atoms; 39 }; 40 41 struct Header Hdr; 42 struct HeaderData HdrData; 43 DataExtractor AccelSection; 44 DataExtractor StringSection; 45 const RelocAddrMap& Relocs; 46 47public: 48 DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection, 49 const RelocAddrMap &Relocs) 50 : AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {} 51 52 bool extract(); 53 uint32_t getNumBuckets(); 54 uint32_t getNumHashes(); 55 uint32_t getSizeHdr(); 56 uint32_t getHeaderDataLength(); 57 void dump(raw_ostream &OS) const; 58}; 59 60} // end namespace llvm 61 62#endif // LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H 63