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