1 //===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
11 #define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
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"
27 class DbiModuleDescriptor;
29 class ModuleDebugStreamRef {
30 using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
33 ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
34 std::unique_ptr<msf::MappedBlockStream> Stream);
35 ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
36 ModuleDebugStreamRef(const ModuleDebugStreamRef &Other) = default;
37 ~ModuleDebugStreamRef();
41 uint32_t signature() const { return Signature; }
43 iterator_range<codeview::CVSymbolArray::Iterator>
44 symbols(bool *HadError) const;
46 const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
47 const codeview::CVSymbolArray
48 getSymbolArrayForScope(uint32_t ScopeBegin) const;
50 BinarySubstreamRef getSymbolsSubstream() const;
51 BinarySubstreamRef getC11LinesSubstream() const;
52 BinarySubstreamRef getC13LinesSubstream() const;
53 BinarySubstreamRef getGlobalRefsSubstream() const;
55 ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;
57 codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const;
59 iterator_range<DebugSubsectionIterator> subsections() const;
60 codeview::DebugSubsectionArray getSubsectionsArray() const {
64 bool hasDebugSubsections() const;
68 Expected<codeview::DebugChecksumsSubsectionRef>
69 findChecksumsSubsection() const;
72 DbiModuleDescriptor Mod;
76 std::shared_ptr<msf::MappedBlockStream> Stream;
78 codeview::CVSymbolArray SymbolArray;
80 BinarySubstreamRef SymbolsSubstream;
81 BinarySubstreamRef C11LinesSubstream;
82 BinarySubstreamRef C13LinesSubstream;
83 BinarySubstreamRef GlobalRefsSubstream;
85 codeview::DebugSubsectionArray Subsections;
88 } // end namespace pdb
89 } // end namespace llvm
91 #endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H