LLVM  5.0.0
InfoStream.h
Go to the documentation of this file.
1 //===- InfoStream.h - PDB Info Stream (Stream 1) 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_PDBINFOSTREAM_H
11 #define LLVM_DEBUGINFO_PDB_RAW_PDBINFOSTREAM_H
12 
13 #include "llvm/ADT/BitmaskEnum.h"
14 #include "llvm/ADT/StringMap.h"
20 
21 #include "llvm/Support/Endian.h"
22 #include "llvm/Support/Error.h"
23 
24 namespace llvm {
25 namespace pdb {
26 class InfoStreamBuilder;
27 class PDBFile;
28 
29 class InfoStream {
30  friend class InfoStreamBuilder;
31 
32 public:
33  InfoStream(std::unique_ptr<msf::MappedBlockStream> Stream);
34 
35  Error reload();
36 
37  uint32_t getStreamSize() const;
38 
39  bool containsIdStream() const;
40  PdbRaw_ImplVer getVersion() const;
41  uint32_t getSignature() const;
42  uint32_t getAge() const;
43  codeview::GUID getGuid() const;
45 
48 
49  const NamedStreamMap &getNamedStreams() const;
50 
52 
55 
56 private:
57  std::unique_ptr<msf::MappedBlockStream> Stream;
58 
59  // PDB file format version. We only support VC70. See the enumeration
60  // `PdbRaw_ImplVer` for the other possible values.
62 
63  // A 32-bit signature unique across all PDBs. This is generated with
64  // a call to time() when the PDB is written, but obviously this is not
65  // universally unique.
66  uint32_t Signature;
67 
68  // The number of times the PDB has been written. Might also be used to
69  // ensure that the PDB matches the executable.
70  uint32_t Age;
71 
72  // Due to the aforementioned limitations with `Signature`, this is a new
73  // signature present on VC70 and higher PDBs which is guaranteed to be
74  // universally unique.
75  codeview::GUID Guid;
76 
77  BinarySubstreamRef SubNamedStreams;
78 
79  std::vector<PdbRaw_FeatureSig> FeatureSignatures;
81 
82  uint32_t NamedStreamMapByteSize = 0;
83 
84  NamedStreamMap NamedStreams;
85 };
86 }
87 }
88 
89 #endif
BinarySubstreamRef getNamedStreamsBuffer() const
Definition: InfoStream.cpp:137
ArrayRef< PdbRaw_FeatureSig > getFeatureSignatures() const
Definition: InfoStream.cpp:129
const NamedStreamMap & getNamedStreams() const
Definition: InfoStream.cpp:133
bool containsIdStream() const
Definition: InfoStream.cpp:109
uint32_t getAge() const
Definition: InfoStream.cpp:119
This represents the 'GUID' type from windows.h.
Definition: GUID.h:22
uint32_t getSignature() const
Definition: InfoStream.cpp:117
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
const char * Name
iterator_range< StringMapConstIterator< uint32_t > > named_streams() const
Definition: InfoStream.cpp:105
uint32_t getStreamSize() const
Definition: InfoStream.cpp:95
PdbRaw_Features getFeatures() const
Definition: InfoStream.cpp:127
PdbRaw_ImplVer getVersion() const
Definition: InfoStream.cpp:113
codeview::GUID getGuid() const
Definition: InfoStream.cpp:121
A range adaptor for a pair of iterators.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:156
const FeatureBitset Features
InfoStream(std::unique_ptr< msf::MappedBlockStream > Stream)
Definition: InfoStream.cpp:25
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint32_t getNamedStreamIndex(llvm::StringRef Name) const
Definition: InfoStream.cpp:97
const uint64_t Version
Definition: InstrProf.h:864
uint32_t getNamedStreamMapByteSize() const
Definition: InfoStream.cpp:123