Home | History | Annotate | Download | only in Native
      1 //===- ModuleDebugStream.h - PDB Module Info Stream Access ----------------===//
      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_MODULEDEBUGSTREAM_H
     11 #define LLVM_DEBUGINFO_PDB_RAW_MODULEDEBUGSTREAM_H
     12 
     13 #include "llvm/ADT/iterator_range.h"
     14 #include "llvm/DebugInfo/CodeView/CVRecord.h"
     15 #include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
     16 #include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
     17 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
     18 #include "llvm/DebugInfo/MSF/MappedBlockStream.h"
     19 #include "llvm/Support/BinaryStreamArray.h"
     20 #include "llvm/Support/BinaryStreamRef.h"
     21 #include "llvm/Support/Error.h"
     22 
     23 namespace llvm {
     24 namespace pdb {
     25 class PDBFile;
     26 class DbiModuleDescriptor;
     27 
     28 class ModuleDebugStreamRef {
     29   typedef codeview::DebugSubsectionArray::Iterator DebugSubsectionIterator;
     30 
     31 public:
     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 {
     45     return SymbolsSubstream;
     46   }
     47 
     48   ModuleDebugStreamRef &operator=(ModuleDebugStreamRef &&Other) = default;
     49 
     50   llvm::iterator_range<DebugSubsectionIterator> subsections() const;
     51 
     52   bool hasDebugSubsections() const;
     53 
     54   Error commit();
     55 
     56   Expected<codeview::DebugChecksumsSubsectionRef>
     57   findChecksumsSubsection() const;
     58 
     59 private:
     60   const DbiModuleDescriptor &Mod;
     61 
     62   uint32_t Signature;
     63 
     64   std::shared_ptr<msf::MappedBlockStream> Stream;
     65 
     66   codeview::CVSymbolArray SymbolsSubstream;
     67   BinaryStreamRef C11LinesSubstream;
     68   BinaryStreamRef C13LinesSubstream;
     69   BinaryStreamRef GlobalRefsSubstream;
     70 
     71   codeview::DebugSubsectionArray Subsections;
     72 };
     73 }
     74 }
     75 
     76 #endif
     77