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