Line data Source code
1 : //===- ModuleDebugStream.h - PDB Module Info Stream 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_NATIVE_MODULEDEBUGSTREAM_H
11 : #define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
12 :
13 : #include "llvm/ADT/iterator_range.h"
14 : #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
15 : #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
16 : #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
17 : #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
18 : #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
19 : #include "llvm/Support/BinaryStreamRef.h"
20 : #include "llvm/Support/Error.h"
21 : #include <cstdint>
22 : #include <memory>
23 :
24 : namespace llvm {
25 : namespace pdb {
26 :
27 : class DbiModuleDescriptor;
28 :
29 1764 : class ModuleDebugStreamRef {
30 : using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
31 :
32 : public:
33 : ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
34 : std::unique_ptr<msf::MappedBlockStream> Stream);
35 554 : ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
36 : ModuleDebugStreamRef(const ModuleDebugStreamRef &Other) = default;
37 : ~ModuleDebugStreamRef();
38 :
39 : Error reload();
40 :
41 0 : uint32_t signature() const { return Signature; }
42 :
43 : iterator_range<codeview::CVSymbolArray::Iterator>
44 : symbols(bool *HadError) const;
45 :
46 : const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
47 :
48 : BinarySubstreamRef getSymbolsSubstream() const;
49 : BinarySubstreamRef getC11LinesSubstream() const;
50 : BinarySubstreamRef getC13LinesSubstream() const;
51 : BinarySubstreamRef getGlobalRefsSubstream() const;
52 :
53 : ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;
54 :
55 : codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const;
56 :
57 : iterator_range<DebugSubsectionIterator> subsections() const;
58 : codeview::DebugSubsectionArray getSubsectionsArray() const {
59 : return Subsections;
60 : }
61 :
62 : bool hasDebugSubsections() const;
63 :
64 : Error commit();
65 :
66 : Expected<codeview::DebugChecksumsSubsectionRef>
67 : findChecksumsSubsection() const;
68 :
69 : private:
70 : DbiModuleDescriptor Mod;
71 :
72 : uint32_t Signature;
73 :
74 : std::shared_ptr<msf::MappedBlockStream> Stream;
75 :
76 : codeview::CVSymbolArray SymbolArray;
77 :
78 : BinarySubstreamRef SymbolsSubstream;
79 : BinarySubstreamRef C11LinesSubstream;
80 : BinarySubstreamRef C13LinesSubstream;
81 : BinarySubstreamRef GlobalRefsSubstream;
82 :
83 : codeview::DebugSubsectionArray Subsections;
84 : };
85 :
86 : } // end namespace pdb
87 : } // end namespace llvm
88 :
89 : #endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
|