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_LIB_DEBUGINFO_DWARFACCELERATORTABLE_H 11 #define LLVM_LIB_DEBUGINFO_DWARFACCELERATORTABLE_H 12 13 #include "llvm/ADT/SmallVector.h" 14 #include "llvm/DebugInfo/DWARF/DWARFFormValue.h" 15 #include "llvm/DebugInfo/DWARF/DWARFRelocMap.h" 16 #include <cstdint> 17 18 namespace llvm { 19 20 class DWARFAcceleratorTable { 21 22 struct Header { 23 uint32_t Magic; 24 uint16_t Version; 25 uint16_t HashFunction; 26 uint32_t NumBuckets; 27 uint32_t NumHashes; 28 uint32_t HeaderDataLength; 29 }; 30 31 struct HeaderData { 32 typedef uint16_t AtomType; 33 typedef uint16_t Form; 34 uint32_t DIEOffsetBase; 35 SmallVector<std::pair<AtomType, Form>, 3> Atoms; 36 }; 37 38 struct Header Hdr; 39 struct HeaderData HdrData; 40 DataExtractor AccelSection; 41 DataExtractor StringSection; 42 const RelocAddrMap& Relocs; 43 public: 44 DWARFAcceleratorTable(DataExtractor AccelSection, DataExtractor StringSection, 45 const RelocAddrMap &Relocs) 46 : AccelSection(AccelSection), StringSection(StringSection), Relocs(Relocs) {} 47 48 bool extract(); 49 void dump(raw_ostream &OS) const; 50 }; 51 52 } 53 54 #endif 55