]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/DebugInfo/PDB/Native/DbiStream.h
Merge llvm trunk r300422 and resolve conflicts.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / DebugInfo / PDB / Native / DbiStream.h
1 //===- DbiStream.h - PDB Dbi Stream (Stream 3) Access -----------*- 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_PDB_RAW_PDBDBISTREAM_H
11 #define LLVM_DEBUGINFO_PDB_RAW_PDBDBISTREAM_H
12
13 #include "llvm/DebugInfo/CodeView/ModuleSubstream.h"
14 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
15 #include "llvm/DebugInfo/PDB/Native/ModInfo.h"
16 #include "llvm/DebugInfo/PDB/Native/RawConstants.h"
17 #include "llvm/DebugInfo/PDB/Native/RawTypes.h"
18 #include "llvm/DebugInfo/PDB/Native/StringTable.h"
19 #include "llvm/DebugInfo/PDB/PDBTypes.h"
20 #include "llvm/Support/BinaryStreamArray.h"
21 #include "llvm/Support/BinaryStreamArray.h"
22 #include "llvm/Support/BinaryStreamRef.h"
23 #include "llvm/Support/BinaryStreamRef.h"
24 #include "llvm/Support/Endian.h"
25 #include "llvm/Support/Error.h"
26
27 namespace llvm {
28 namespace object {
29 struct FpoData;
30 struct coff_section;
31 }
32
33 namespace pdb {
34 class DbiStreamBuilder;
35 class PDBFile;
36 class ISectionContribVisitor;
37
38 class DbiStream {
39   friend class DbiStreamBuilder;
40
41 public:
42   DbiStream(PDBFile &File, std::unique_ptr<msf::MappedBlockStream> Stream);
43   ~DbiStream();
44   Error reload();
45
46   PdbRaw_DbiVer getDbiVersion() const;
47   uint32_t getAge() const;
48   uint16_t getPublicSymbolStreamIndex() const;
49   uint16_t getGlobalSymbolStreamIndex() const;
50
51   uint16_t getFlags() const;
52   bool isIncrementallyLinked() const;
53   bool hasCTypes() const;
54   bool isStripped() const;
55
56   uint16_t getBuildNumber() const;
57   uint16_t getBuildMajorVersion() const;
58   uint16_t getBuildMinorVersion() const;
59
60   uint16_t getPdbDllRbld() const;
61   uint32_t getPdbDllVersion() const;
62
63   uint32_t getSymRecordStreamIndex() const;
64
65   PDB_Machine getMachineType() const;
66
67   /// If the given stream type is present, returns its stream index. If it is
68   /// not present, returns InvalidStreamIndex.
69   uint32_t getDebugStreamIndex(DbgHeaderType Type) const;
70
71   ArrayRef<ModuleInfoEx> modules() const;
72
73   Expected<StringRef> getFileNameForIndex(uint32_t Index) const;
74
75   FixedStreamArray<object::coff_section> getSectionHeaders();
76
77   FixedStreamArray<object::FpoData> getFpoRecords();
78
79   FixedStreamArray<SecMapEntry> getSectionMap() const;
80   void visitSectionContributions(ISectionContribVisitor &Visitor) const;
81
82 private:
83   Error initializeModInfoArray();
84   Error initializeSectionContributionData();
85   Error initializeSectionHeadersData();
86   Error initializeSectionMapData();
87   Error initializeFileInfo();
88   Error initializeFpoRecords();
89
90   PDBFile &Pdb;
91   std::unique_ptr<msf::MappedBlockStream> Stream;
92
93   std::vector<ModuleInfoEx> ModuleInfos;
94   StringTable ECNames;
95
96   BinaryStreamRef ModInfoSubstream;
97   BinaryStreamRef SecContrSubstream;
98   BinaryStreamRef SecMapSubstream;
99   BinaryStreamRef FileInfoSubstream;
100   BinaryStreamRef TypeServerMapSubstream;
101   BinaryStreamRef ECSubstream;
102
103   BinaryStreamRef NamesBuffer;
104
105   FixedStreamArray<support::ulittle16_t> DbgStreams;
106
107   PdbRaw_DbiSecContribVer SectionContribVersion;
108   FixedStreamArray<SectionContrib> SectionContribs;
109   FixedStreamArray<SectionContrib2> SectionContribs2;
110   FixedStreamArray<SecMapEntry> SectionMap;
111   FixedStreamArray<support::little32_t> FileNameOffsets;
112
113   std::unique_ptr<msf::MappedBlockStream> SectionHeaderStream;
114   FixedStreamArray<object::coff_section> SectionHeaders;
115
116   std::unique_ptr<msf::MappedBlockStream> FpoStream;
117   FixedStreamArray<object::FpoData> FpoRecords;
118
119   const DbiStreamHeader *Header;
120 };
121 }
122 }
123
124 #endif