LLVM  14.0.0git
DWARFDebugAbbrev.h
Go to the documentation of this file.
1 //===- DWARFDebugAbbrev.h ---------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
10 #define LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
11 
14 #include <cstdint>
15 #include <map>
16 #include <vector>
17 
18 namespace llvm {
19 
20 class raw_ostream;
21 
23  uint64_t Offset;
24  /// Code of the first abbreviation, if all abbreviations in the set have
25  /// consecutive codes. UINT32_MAX otherwise.
26  uint32_t FirstAbbrCode;
27  std::vector<DWARFAbbreviationDeclaration> Decls;
28 
29  using const_iterator =
30  std::vector<DWARFAbbreviationDeclaration>::const_iterator;
31 
32 public:
34 
35  uint64_t getOffset() const { return Offset; }
36  void dump(raw_ostream &OS) const;
37  bool extract(DataExtractor Data, uint64_t *OffsetPtr);
38 
40  getAbbreviationDeclaration(uint32_t AbbrCode) const;
41 
42  const_iterator begin() const {
43  return Decls.begin();
44  }
45 
46  const_iterator end() const {
47  return Decls.end();
48  }
49 
50  std::string getCodeRange() const;
51 
52 private:
53  void clear();
54 };
55 
57  using DWARFAbbreviationDeclarationSetMap =
58  std::map<uint64_t, DWARFAbbreviationDeclarationSet>;
59 
60  mutable DWARFAbbreviationDeclarationSetMap AbbrDeclSets;
61  mutable DWARFAbbreviationDeclarationSetMap::const_iterator PrevAbbrOffsetPos;
62  mutable Optional<DataExtractor> Data;
63 
64 public:
66 
68  getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const;
69 
70  void dump(raw_ostream &OS) const;
71  void parse() const;
73 
74  DWARFAbbreviationDeclarationSetMap::const_iterator begin() const {
75  parse();
76  return AbbrDeclSets.begin();
77  }
78 
79  DWARFAbbreviationDeclarationSetMap::const_iterator end() const {
80  return AbbrDeclSets.end();
81  }
82 
83 private:
84  void clear();
85 };
86 
87 } // end namespace llvm
88 
89 #endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGABBREV_H
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::DWARFAbbreviationDeclarationSet::begin
const_iterator begin() const
Definition: DWARFDebugAbbrev.h:42
llvm::DWARFDebugAbbrev::begin
DWARFAbbreviationDeclarationSetMap::const_iterator begin() const
Definition: DWARFDebugAbbrev.h:74
llvm::DWARFAbbreviationDeclarationSet::getAbbreviationDeclaration
const DWARFAbbreviationDeclaration * getAbbreviationDeclaration(uint32_t AbbrCode) const
Definition: DWARFDebugAbbrev.cpp:56
llvm::DWARFDebugAbbrev::extract
void extract(DataExtractor Data)
Definition: DWARFDebugAbbrev.cpp:106
llvm::Optional
Definition: APInt.h:33
llvm::DWARFAbbreviationDeclarationSet::extract
bool extract(DataExtractor Data, uint64_t *OffsetPtr)
Definition: DWARFDebugAbbrev.cpp:28
llvm::DWARFAbbreviationDeclarationSet::end
const_iterator end() const
Definition: DWARFDebugAbbrev.h:46
llvm::Data
@ Data
Definition: SIMachineScheduler.h:55
llvm::DWARFAbbreviationDeclarationSet::DWARFAbbreviationDeclarationSet
DWARFAbbreviationDeclarationSet()
Definition: DWARFDebugAbbrev.cpp:18
llvm::DWARFDebugAbbrev
Definition: DWARFDebugAbbrev.h:56
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::DWARFAbbreviationDeclarationSet::getCodeRange
std::string getCodeRange() const
Definition: DWARFDebugAbbrev.cpp:70
llvm::DWARFAbbreviationDeclarationSet
Definition: DWARFDebugAbbrev.h:22
llvm::DWARFDebugAbbrev::end
DWARFAbbreviationDeclarationSetMap::const_iterator end() const
Definition: DWARFDebugAbbrev.h:79
uint64_t
llvm::DWARFDebugAbbrev::DWARFDebugAbbrev
DWARFDebugAbbrev()
Definition: DWARFDebugAbbrev.cpp:99
DWARFAbbreviationDeclaration.h
llvm::DWARFDebugAbbrev::parse
void parse() const
Definition: DWARFDebugAbbrev.cpp:111
llvm::DWARFDebugAbbrev::getAbbreviationDeclarationSet
const DWARFAbbreviationDeclarationSet * getAbbreviationDeclarationSet(uint64_t CUAbbrOffset) const
Definition: DWARFDebugAbbrev.cpp:143
uint32_t
llvm::DWARFAbbreviationDeclaration
Definition: DWARFAbbreviationDeclaration.h:27
DataExtractor.h
llvm::DataExtractor
Definition: DataExtractor.h:41
llvm::DWARFDebugAbbrev::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugAbbrev.cpp:128
llvm::DWARFAbbreviationDeclarationSet::dump
void dump(raw_ostream &OS) const
Definition: DWARFDebugAbbrev.cpp:50
llvm::DWARFAbbreviationDeclarationSet::getOffset
uint64_t getOffset() const
Definition: DWARFDebugAbbrev.h:35