LCOV - code coverage report
Current view: top level - include/llvm/DebugInfo/PDB/Raw - PDBFile.h (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 4 4 100.0 %
Date: 2017-01-24 23:09:07 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- PDBFile.h - Low level interface to a PDB file ------------*- 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_RAW_PDBFILE_H
      11             : #define LLVM_DEBUGINFO_PDB_RAW_PDBFILE_H
      12             : 
      13             : #include "llvm/ADT/DenseMap.h"
      14             : #include "llvm/DebugInfo/MSF/IMSFFile.h"
      15             : #include "llvm/DebugInfo/MSF/MSFCommon.h"
      16             : #include "llvm/DebugInfo/MSF/StreamArray.h"
      17             : #include "llvm/DebugInfo/MSF/StreamInterface.h"
      18             : #include "llvm/Support/Allocator.h"
      19             : #include "llvm/Support/Endian.h"
      20             : #include "llvm/Support/Error.h"
      21             : #include "llvm/Support/MathExtras.h"
      22             : 
      23             : #include <memory>
      24             : 
      25             : namespace llvm {
      26             : 
      27             : namespace msf {
      28             : class MappedBlockStream;
      29             : }
      30             : 
      31             : namespace pdb {
      32             : class DbiStream;
      33             : class GlobalsStream;
      34             : class InfoStream;
      35             : class StringTable;
      36             : class PDBFileBuilder;
      37             : class PublicsStream;
      38             : class SymbolStream;
      39             : class TpiStream;
      40             : 
      41         126 : class PDBFile : public msf::IMSFFile {
      42             :   friend PDBFileBuilder;
      43             : 
      44             : public:
      45             :   PDBFile(std::unique_ptr<msf::ReadableStream> PdbFileBuffer,
      46             :           BumpPtrAllocator &Allocator);
      47             :   ~PDBFile() override;
      48             : 
      49             :   uint32_t getFreeBlockMapBlock() const;
      50             :   uint32_t getUnknown1() const;
      51             : 
      52             :   uint32_t getBlockSize() const override;
      53             :   uint32_t getBlockCount() const override;
      54             :   uint32_t getNumDirectoryBytes() const;
      55             :   uint32_t getBlockMapIndex() const;
      56             :   uint32_t getNumDirectoryBlocks() const;
      57             :   uint64_t getBlockMapOffset() const;
      58             : 
      59             :   uint32_t getNumStreams() const override;
      60             :   uint32_t getStreamByteSize(uint32_t StreamIndex) const override;
      61             :   ArrayRef<support::ulittle32_t>
      62             :   getStreamBlockList(uint32_t StreamIndex) const override;
      63             :   uint32_t getFileSize() const;
      64             : 
      65             :   Expected<ArrayRef<uint8_t>> getBlockData(uint32_t BlockIndex,
      66             :                                            uint32_t NumBytes) const override;
      67             :   Error setBlockData(uint32_t BlockIndex, uint32_t Offset,
      68             :                      ArrayRef<uint8_t> Data) const override;
      69             : 
      70             :   ArrayRef<uint32_t> getFpmPages() const { return FpmPages; }
      71             : 
      72             :   ArrayRef<support::ulittle32_t> getStreamSizes() const {
      73             :     return ContainerLayout.StreamSizes;
      74             :   }
      75             :   ArrayRef<ArrayRef<support::ulittle32_t>> getStreamMap() const {
      76          14 :     return ContainerLayout.StreamMap;
      77             :   }
      78             : 
      79          40 :   const msf::MSFLayout &getMsfLayout() const { return ContainerLayout; }
      80          80 :   const msf::ReadableStream &getMsfBuffer() const { return *Buffer; }
      81             : 
      82             :   ArrayRef<support::ulittle32_t> getDirectoryBlockArray() const;
      83             : 
      84             :   Error parseFileHeaders();
      85             :   Error parseStreamData();
      86             : 
      87             :   Expected<InfoStream &> getPDBInfoStream();
      88             :   Expected<DbiStream &> getPDBDbiStream();
      89             :   Expected<GlobalsStream &> getPDBGlobalsStream();
      90             :   Expected<TpiStream &> getPDBTpiStream();
      91             :   Expected<TpiStream &> getPDBIpiStream();
      92             :   Expected<PublicsStream &> getPDBPublicsStream();
      93             :   Expected<SymbolStream &> getPDBSymbolStream();
      94             :   Expected<StringTable &> getStringTable();
      95             : 
      96             :   BumpPtrAllocator &getAllocator() { return Allocator; }
      97             : 
      98             :   bool hasPDBDbiStream() const;
      99             :   bool hasPDBGlobalsStream();
     100             :   bool hasPDBInfoStream();
     101             :   bool hasPDBIpiStream() const;
     102             :   bool hasPDBPublicsStream();
     103             :   bool hasPDBSymbolStream();
     104             :   bool hasPDBTpiStream() const;
     105             :   bool hasStringTable();
     106             : 
     107             :  private:
     108             :   Expected<std::unique_ptr<msf::MappedBlockStream>> safelyCreateIndexedStream(
     109             :       const msf::MSFLayout &Layout, const msf::ReadableStream &MsfData,
     110             :       uint32_t StreamIndex) const;
     111             : 
     112             :   BumpPtrAllocator &Allocator;
     113             : 
     114             :   std::unique_ptr<msf::ReadableStream> Buffer;
     115             : 
     116             :   std::vector<uint32_t> FpmPages;
     117             :   msf::MSFLayout ContainerLayout;
     118             : 
     119             :   std::unique_ptr<GlobalsStream> Globals;
     120             :   std::unique_ptr<InfoStream> Info;
     121             :   std::unique_ptr<DbiStream> Dbi;
     122             :   std::unique_ptr<TpiStream> Tpi;
     123             :   std::unique_ptr<TpiStream> Ipi;
     124             :   std::unique_ptr<PublicsStream> Publics;
     125             :   std::unique_ptr<SymbolStream> Symbols;
     126             :   std::unique_ptr<msf::MappedBlockStream> DirectoryStream;
     127             :   std::unique_ptr<msf::MappedBlockStream> StringTableStream;
     128             :   std::unique_ptr<StringTable> Strings;
     129             : };
     130             : }
     131             : }
     132             : 
     133             : #endif

Generated by: LCOV version 1.13