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/StringMap.h" 14 #include "llvm/DebugInfo/PDB/PDBTypes.h" 15 #include "llvm/DebugInfo/PDB/Raw/MappedBlockStream.h" 16 #include "llvm/DebugInfo/PDB/Raw/NameMap.h" 17 #include "llvm/DebugInfo/PDB/Raw/RawConstants.h" 18 19 #include "llvm/Support/Endian.h" 20 #include "llvm/Support/Error.h" 21 22 namespace llvm { 23 namespace pdb { 24 class InfoStreamBuilder; 25 class PDBFile; 26 27 class InfoStream { 28 friend class InfoStreamBuilder; 29 30 struct Header { 31 support::ulittle32_t Version; 32 support::ulittle32_t Signature; 33 support::ulittle32_t Age; 34 PDB_UniqueId Guid; 35 }; 36 37 public: 38 InfoStream(std::unique_ptr<MappedBlockStream> Stream); 39 40 Error reload(); 41 Error commit(); 42 43 PdbRaw_ImplVer getVersion() const; 44 uint32_t getSignature() const; 45 uint32_t getAge() const; 46 PDB_UniqueId getGuid() const; 47 48 uint32_t getNamedStreamIndex(llvm::StringRef Name) const; 49 iterator_range<StringMapConstIterator<uint32_t>> named_streams() const; 50 51 private: 52 std::unique_ptr<MappedBlockStream> Stream; 53 54 // PDB file format version. We only support VC70. See the enumeration 55 // `PdbRaw_ImplVer` for the other possible values. 56 uint32_t Version; 57 58 // A 32-bit signature unique across all PDBs. This is generated with 59 // a call to time() when the PDB is written, but obviously this is not 60 // universally unique. 61 uint32_t Signature; 62 63 // The number of times the PDB has been written. Might also be used to 64 // ensure that the PDB matches the executable. 65 uint32_t Age; 66 67 // Due to the aforementioned limitations with `Signature`, this is a new 68 // signature present on VC70 and higher PDBs which is guaranteed to be 69 // universally unique. 70 PDB_UniqueId Guid; 71 72 NameMap NamedStreams; 73 }; 74 } 75 } 76 77 #endif 78