Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:44

0001 //===- ModuleDebugStream.h - PDB Module Info Stream Access ------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
0010 #define LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H
0011 
0012 #include "llvm/ADT/iterator_range.h"
0013 #include "llvm/DebugInfo/CodeView/CVRecord.h"
0014 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
0015 #include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptor.h"
0016 #include "llvm/Support/BinaryStreamRef.h"
0017 #include "llvm/Support/Error.h"
0018 #include <cstdint>
0019 #include <memory>
0020 
0021 namespace llvm {
0022 class BinaryStreamReader;
0023 namespace codeview {
0024 class DebugChecksumsSubsectionRef;
0025 }
0026 namespace msf {
0027 class MappedBlockStream;
0028 }
0029 namespace pdb {
0030 
0031 class ModuleDebugStreamRef {
0032   using DebugSubsectionIterator = codeview::DebugSubsectionArray::Iterator;
0033 
0034 public:
0035   ModuleDebugStreamRef(const DbiModuleDescriptor &Module,
0036                        std::unique_ptr<msf::MappedBlockStream> Stream);
0037   ModuleDebugStreamRef(ModuleDebugStreamRef &&Other) = default;
0038   ModuleDebugStreamRef(const ModuleDebugStreamRef &Other) = default;
0039   ~ModuleDebugStreamRef();
0040 
0041   Error reload();
0042 
0043   uint32_t signature() const { return Signature; }
0044 
0045   iterator_range<codeview::CVSymbolArray::Iterator>
0046   symbols(bool *HadError) const;
0047 
0048   const codeview::CVSymbolArray &getSymbolArray() const { return SymbolArray; }
0049   const codeview::CVSymbolArray
0050   getSymbolArrayForScope(uint32_t ScopeBegin) const;
0051 
0052   BinarySubstreamRef getSymbolsSubstream() const;
0053   BinarySubstreamRef getC11LinesSubstream() const;
0054   BinarySubstreamRef getC13LinesSubstream() const;
0055   BinarySubstreamRef getGlobalRefsSubstream() const;
0056 
0057   ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = delete;
0058 
0059   codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const;
0060 
0061   iterator_range<DebugSubsectionIterator> subsections() const;
0062   codeview::DebugSubsectionArray getSubsectionsArray() const {
0063     return Subsections;
0064   }
0065 
0066   bool hasDebugSubsections() const;
0067 
0068   Error commit();
0069 
0070   Expected<codeview::DebugChecksumsSubsectionRef>
0071   findChecksumsSubsection() const;
0072 
0073 private:
0074   Error reloadSerialize(BinaryStreamReader &Reader);
0075 
0076   DbiModuleDescriptor Mod;
0077 
0078   uint32_t Signature;
0079 
0080   std::shared_ptr<msf::MappedBlockStream> Stream;
0081 
0082   codeview::CVSymbolArray SymbolArray;
0083 
0084   BinarySubstreamRef SymbolsSubstream;
0085   BinarySubstreamRef C11LinesSubstream;
0086   BinarySubstreamRef C13LinesSubstream;
0087   BinarySubstreamRef GlobalRefsSubstream;
0088 
0089   codeview::DebugSubsectionArray Subsections;
0090 };
0091 
0092 } // end namespace pdb
0093 } // end namespace llvm
0094 
0095 #endif // LLVM_DEBUGINFO_PDB_NATIVE_MODULEDEBUGSTREAM_H