DWARFDebugAbbrev.h revision 234353
1//===-- DWARFDebugAbbrev.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_DWARFDEBUGABBREV_H 11#define LLVM_DEBUGINFO_DWARFDEBUGABBREV_H 12 13#include "DWARFAbbreviationDeclaration.h" 14#include <list> 15#include <map> 16#include <vector> 17 18namespace llvm { 19 20typedef std::vector<DWARFAbbreviationDeclaration> 21 DWARFAbbreviationDeclarationColl; 22typedef DWARFAbbreviationDeclarationColl::iterator 23 DWARFAbbreviationDeclarationCollIter; 24typedef DWARFAbbreviationDeclarationColl::const_iterator 25 DWARFAbbreviationDeclarationCollConstIter; 26 27class DWARFAbbreviationDeclarationSet { 28 uint32_t Offset; 29 uint32_t IdxOffset; 30 std::vector<DWARFAbbreviationDeclaration> Decls; 31 public: 32 DWARFAbbreviationDeclarationSet() 33 : Offset(0), IdxOffset(0) {} 34 35 DWARFAbbreviationDeclarationSet(uint32_t offset, uint32_t idxOffset) 36 : Offset(offset), IdxOffset(idxOffset) {} 37 38 void clear() { 39 IdxOffset = 0; 40 Decls.clear(); 41 } 42 uint32_t getOffset() const { return Offset; } 43 void dump(raw_ostream &OS) const; 44 bool extract(DataExtractor data, uint32_t* offset_ptr); 45 46 const DWARFAbbreviationDeclaration * 47 getAbbreviationDeclaration(uint32_t abbrCode) const; 48}; 49 50class DWARFDebugAbbrev { 51public: 52 typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet> 53 DWARFAbbreviationDeclarationCollMap; 54 typedef DWARFAbbreviationDeclarationCollMap::iterator 55 DWARFAbbreviationDeclarationCollMapIter; 56 typedef DWARFAbbreviationDeclarationCollMap::const_iterator 57 DWARFAbbreviationDeclarationCollMapConstIter; 58 59private: 60 DWARFAbbreviationDeclarationCollMap AbbrevCollMap; 61 mutable DWARFAbbreviationDeclarationCollMapConstIter PrevAbbrOffsetPos; 62 63public: 64 DWARFDebugAbbrev(); 65 const DWARFAbbreviationDeclarationSet * 66 getAbbreviationDeclarationSet(uint64_t cu_abbr_offset) const; 67 void dump(raw_ostream &OS) const; 68 void parse(DataExtractor data); 69}; 70 71} 72 73#endif 74