LCOV - code coverage report
Current view: top level - lib/DebugInfo/PDB/Raw - RawSession.cpp (source / functions) Hit Total Coverage
Test: llvm-toolchain.info Lines: 15 47 31.9 %
Date: 2017-01-24 23:09:07 Functions: 2 18 11.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //===- RawSession.cpp - Raw implementation of IPDBSession -------*- 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             : #include "llvm/ADT/STLExtras.h"
      11             : #include "llvm/DebugInfo/MSF/ByteStream.h"
      12             : #include "llvm/DebugInfo/PDB/GenericError.h"
      13             : #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
      14             : #include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
      15             : #include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
      16             : #include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
      17             : #include "llvm/DebugInfo/PDB/Raw/PDBFile.h"
      18             : #include "llvm/DebugInfo/PDB/Raw/RawError.h"
      19             : #include "llvm/DebugInfo/PDB/Raw/RawSession.h"
      20             : #include "llvm/Support/Allocator.h"
      21             : #include "llvm/Support/Error.h"
      22             : #include "llvm/Support/ErrorOr.h"
      23             : #include "llvm/Support/MemoryBuffer.h"
      24             : #include <algorithm>
      25             : #include <memory>
      26             : 
      27             : using namespace llvm;
      28             : using namespace llvm::msf;
      29             : using namespace llvm::pdb;
      30             : 
      31          18 : RawSession::RawSession(std::unique_ptr<PDBFile> PdbFile,
      32          18 :                        std::unique_ptr<BumpPtrAllocator> Allocator)
      33          54 :     : Pdb(std::move(PdbFile)), Allocator(std::move(Allocator)) {}
      34             : 
      35             : RawSession::~RawSession() = default;
      36             : 
      37          19 : Error RawSession::createFromPdb(StringRef Path,
      38             :                                 std::unique_ptr<IPDBSession> &Session) {
      39             :   ErrorOr<std::unique_ptr<MemoryBuffer>> ErrorOrBuffer =
      40             :       MemoryBuffer::getFileOrSTDIN(Path, /*FileSize=*/-1,
      41          38 :                                    /*RequiresNullTerminator=*/false);
      42          19 :   if (!ErrorOrBuffer)
      43           0 :     return make_error<GenericError>(generic_error_code::invalid_path);
      44             : 
      45          38 :   std::unique_ptr<MemoryBuffer> Buffer = std::move(*ErrorOrBuffer);
      46          38 :   auto Stream = llvm::make_unique<MemoryBufferByteStream>(std::move(Buffer));
      47             : 
      48          38 :   auto Allocator = llvm::make_unique<BumpPtrAllocator>();
      49          38 :   auto File = llvm::make_unique<PDBFile>(std::move(Stream), *Allocator);
      50          56 :   if (auto EC = File->parseFileHeaders())
      51           2 :     return EC;
      52          54 :   if (auto EC = File->parseStreamData())
      53           0 :     return EC;
      54             : 
      55             :   Session =
      56          54 :       llvm::make_unique<RawSession>(std::move(File), std::move(Allocator));
      57             : 
      58          54 :   return Error::success();
      59             : }
      60             : 
      61           0 : Error RawSession::createFromExe(StringRef Path,
      62             :                                 std::unique_ptr<IPDBSession> &Session) {
      63           0 :   return make_error<RawError>(raw_error_code::feature_unsupported);
      64             : }
      65             : 
      66           0 : uint64_t RawSession::getLoadAddress() const { return 0; }
      67             : 
      68           0 : void RawSession::setLoadAddress(uint64_t Address) {}
      69             : 
      70           0 : std::unique_ptr<PDBSymbolExe> RawSession::getGlobalScope() const {
      71           0 :   return nullptr;
      72             : }
      73             : 
      74           0 : std::unique_ptr<PDBSymbol> RawSession::getSymbolById(uint32_t SymbolId) const {
      75           0 :   return nullptr;
      76             : }
      77             : 
      78             : std::unique_ptr<PDBSymbol>
      79           0 : RawSession::findSymbolByAddress(uint64_t Address, PDB_SymType Type) const {
      80           0 :   return nullptr;
      81             : }
      82             : 
      83             : std::unique_ptr<IPDBEnumLineNumbers>
      84           0 : RawSession::findLineNumbers(const PDBSymbolCompiland &Compiland,
      85             :                             const IPDBSourceFile &File) const {
      86           0 :   return nullptr;
      87             : }
      88             : 
      89             : std::unique_ptr<IPDBEnumLineNumbers>
      90           0 : RawSession::findLineNumbersByAddress(uint64_t Address, uint32_t Length) const {
      91           0 :   return nullptr;
      92             : }
      93             : 
      94             : std::unique_ptr<IPDBEnumSourceFiles>
      95           0 : RawSession::findSourceFiles(const PDBSymbolCompiland *Compiland,
      96             :                             StringRef Pattern,
      97             :                             PDB_NameSearchFlags Flags) const {
      98           0 :   return nullptr;
      99             : }
     100             : 
     101             : std::unique_ptr<IPDBSourceFile>
     102           0 : RawSession::findOneSourceFile(const PDBSymbolCompiland *Compiland,
     103             :                               StringRef Pattern,
     104             :                               PDB_NameSearchFlags Flags) const {
     105           0 :   return nullptr;
     106             : }
     107             : 
     108             : std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
     109           0 : RawSession::findCompilandsForSourceFile(StringRef Pattern,
     110             :                                         PDB_NameSearchFlags Flags) const {
     111           0 :   return nullptr;
     112             : }
     113             : 
     114             : std::unique_ptr<PDBSymbolCompiland>
     115           0 : RawSession::findOneCompilandForSourceFile(StringRef Pattern,
     116             :                                           PDB_NameSearchFlags Flags) const {
     117           0 :   return nullptr;
     118             : }
     119             : 
     120           0 : std::unique_ptr<IPDBEnumSourceFiles> RawSession::getAllSourceFiles() const {
     121           0 :   return nullptr;
     122             : }
     123             : 
     124           0 : std::unique_ptr<IPDBEnumSourceFiles> RawSession::getSourceFilesForCompiland(
     125             :     const PDBSymbolCompiland &Compiland) const {
     126           0 :   return nullptr;
     127             : }
     128             : 
     129             : std::unique_ptr<IPDBSourceFile>
     130           0 : RawSession::getSourceFileById(uint32_t FileId) const {
     131           0 :   return nullptr;
     132             : }
     133             : 
     134           0 : std::unique_ptr<IPDBEnumDataStreams> RawSession::getDebugStreams() const {
     135           0 :   return nullptr;
     136             : }

Generated by: LCOV version 1.13