Home | History | Annotate | Download | only in Native
      1 //===- NativeSession.h - Native 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 #ifndef LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
     11 #define LLVM_DEBUGINFO_PDB_RAW_RAWSESSION_H
     12 
     13 #include "llvm/ADT/StringRef.h"
     14 #include "llvm/DebugInfo/PDB/IPDBSession.h"
     15 #include "llvm/Support/Allocator.h"
     16 #include "llvm/Support/Error.h"
     17 
     18 namespace llvm {
     19 namespace pdb {
     20 class PDBFile;
     21 
     22 class NativeSession : public IPDBSession {
     23 public:
     24   NativeSession(std::unique_ptr<PDBFile> PdbFile,
     25                 std::unique_ptr<BumpPtrAllocator> Allocator);
     26   ~NativeSession() override;
     27 
     28   static Error createFromPdb(StringRef Path,
     29                              std::unique_ptr<IPDBSession> &Session);
     30   static Error createFromExe(StringRef Path,
     31                              std::unique_ptr<IPDBSession> &Session);
     32 
     33   uint64_t getLoadAddress() const override;
     34   void setLoadAddress(uint64_t Address) override;
     35   std::unique_ptr<PDBSymbolExe> getGlobalScope() const override;
     36   std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
     37 
     38   std::unique_ptr<PDBSymbol>
     39   findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
     40 
     41   std::unique_ptr<IPDBEnumLineNumbers>
     42   findLineNumbers(const PDBSymbolCompiland &Compiland,
     43                   const IPDBSourceFile &File) const override;
     44   std::unique_ptr<IPDBEnumLineNumbers>
     45   findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override;
     46 
     47   std::unique_ptr<IPDBEnumSourceFiles>
     48   findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
     49                   PDB_NameSearchFlags Flags) const override;
     50   std::unique_ptr<IPDBSourceFile>
     51   findOneSourceFile(const PDBSymbolCompiland *Compiland,
     52                     llvm::StringRef Pattern,
     53                     PDB_NameSearchFlags Flags) const override;
     54   std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
     55   findCompilandsForSourceFile(llvm::StringRef Pattern,
     56                               PDB_NameSearchFlags Flags) const override;
     57   std::unique_ptr<PDBSymbolCompiland>
     58   findOneCompilandForSourceFile(llvm::StringRef Pattern,
     59                                 PDB_NameSearchFlags Flags) const override;
     60   std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
     61   std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
     62       const PDBSymbolCompiland &Compiland) const override;
     63   std::unique_ptr<IPDBSourceFile>
     64   getSourceFileById(uint32_t FileId) const override;
     65 
     66   std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
     67 
     68   PDBFile &getPDBFile() { return *Pdb; }
     69   const PDBFile &getPDBFile() const { return *Pdb; }
     70 
     71 private:
     72   std::unique_ptr<PDBFile> Pdb;
     73   std::unique_ptr<BumpPtrAllocator> Allocator;
     74 };
     75 }
     76 }
     77 
     78 #endif
     79