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