• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
11 #define LLVM_LIB_DEBUGINFO_DWARFDEBUGABBREV_H
12 
13 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
14 #include <map>
15 #include <vector>
16 
17 namespace llvm {
18 
19 class DWARFAbbreviationDeclarationSet {
20   uint32_t Offset;
21   /// Code of the first abbreviation, if all abbreviations in the set have
22   /// consecutive codes. UINT32_MAX otherwise.
23   uint32_t FirstAbbrCode;
24   std::vector<DWARFAbbreviationDeclaration> Decls;
25 
26 public:
27   DWARFAbbreviationDeclarationSet();
28 
getOffset()29   uint32_t getOffset() const { return Offset; }
30   void dump(raw_ostream &OS) const;
31   bool extract(DataExtractor Data, uint32_t *OffsetPtr);
32 
33   const DWARFAbbreviationDeclaration *
34   getAbbreviationDeclaration(uint32_t AbbrCode) const;
35 
36 private:
37   void clear();
38 };
39 
40 class DWARFDebugAbbrev {
41   typedef std::map<uint64_t, DWARFAbbreviationDeclarationSet>
42     DWARFAbbreviationDeclarationSetMap;
43 
44   DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
45   mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
46 
47 public:
48   DWARFDebugAbbrev();
49 
50   const DWARFAbbreviationDeclarationSet *
51   getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
52 
53   void dump(raw_ostream &OS) const;
54   void extract(DataExtractor Data);
55 
56 private:
57   void clear();
58 };
59 
60 }
61 
62 #endif
63