ModuleDebugStream.h revision 321369
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/Support/BinaryStreamRef.h" 19#include "llvm/Support/Error.h" 20#include <cstdint> 21#include <memory> 22 23namespace llvm { 24namespace pdb { 25 26class DbiModuleDescriptor; 27 28class ModuleDebugStreamRef { 29 using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator; 30 31public: 32 ModuleDebugStreamRef(const DbiModuleDescriptor &Module, 33 std::unique_ptr<msf::MappedBlockStream> Stream); 34 ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default; 35 ~ModuleDebugStreamRef(); 36 37 Error reload(); 38 39 uint32_t signature() const { return Signature; } 40 41 iterator_range<codeview::CVSymbolArray::Iterator> 42 symbols(bool *HadError) const; 43 44 const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; } 45 46 BinarySubstreamRef getSymbolsSubstream() const; 47 BinarySubstreamRef getC11LinesSubstream() const; 48 BinarySubstreamRef getC13LinesSubstream() const; 49 BinarySubstreamRef getGlobalRefsSubstream() const; 50 51 ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default; 52 53 iterator_range<DebugSubsectionIterator> subsections() const; 54 55 bool hasDebugSubsections() const; 56 57 Error commit(); 58 59 Expected<codeview::DebugChecksumsSubsectionRef> 60 findChecksumsSubsection() const; 61 62private: 63 const DbiModuleDescriptor &Mod; 64 65 uint32_t Signature; 66 67 std::shared_ptr<msf::MappedBlockStream> Stream; 68 69 codeview::CVSymbolArray SymbolArray; 70 71 BinarySubstreamRef SymbolsSubstream; 72 BinarySubstreamRef C11LinesSubstream; 73 BinarySubstreamRef C13LinesSubstream; 74 BinarySubstreamRef GlobalRefsSubstream; 75 76 codeview::DebugSubsectionArray Subsections; 77}; 78 79} // end namespace pdb 80} // end namespace llvm 81 82#endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H 83