LLVM  4.0.0
RawSession.h
Go to the documentation of this file.
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"
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 RawSession : public IPDBSession {
23 public:
24  RawSession(std::unique_ptr<PDBFile> PdbFile,
25  std::unique_ptr<BumpPtrAllocator> Allocator);
26  ~RawSession() 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>
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>>
56  PDB_NameSearchFlags Flags) const override;
57  std::unique_ptr<PDBSymbolCompiland>
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
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
Definition: IPDBSession.h:25
void setLoadAddress(uint64_t Address) override
Definition: RawSession.cpp:68
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: RawSession.cpp:102
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:91
std::unique_ptr< PDBSymbolExe > getGlobalScope() const override
Definition: RawSession.cpp:70
This file defines the MallocAllocator and BumpPtrAllocator interfaces.
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: RawSession.cpp:90
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: RawSession.cpp:95
struct fuzzer::@269 Flags
std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const override
Definition: RawSession.cpp:74
const PDBFile & getPDBFile() const
Definition: RawSession.h:69
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: RawSession.cpp:115
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
Definition: RawSession.cpp:130
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
Definition: PDBTypes.h:162
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
Definition: RawSession.cpp:120
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: RawSession.cpp:134
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: RawSession.cpp:109
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: RawSession.cpp:37
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: RawSession.cpp:84
PDBFile & getPDBFile()
Definition: RawSession.h:68
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override
Definition: RawSession.cpp:79
RawSession(std::unique_ptr< PDBFile > PdbFile, std::unique_ptr< BumpPtrAllocator > Allocator)
Definition: RawSession.cpp:31
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: RawSession.cpp:124
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: RawSession.cpp:61
Lightweight error class with error context and mandatory checking.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:47
uint64_t getLoadAddress() const override
Definition: RawSession.cpp:66