LLVM  10.0.0svn
IPDBSession.h
Go to the documentation of this file.
1 //===- IPDBSession.h - base interface for a PDB symbol context --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_PDB_IPDBSESSION_H
10 #define LLVM_DEBUGINFO_PDB_IPDBSESSION_H
11 
12 #include "PDBSymbol.h"
13 #include "PDBTypes.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Support/Casting.h"
16 #include <memory>
17 
18 namespace llvm {
19 namespace pdb {
20 class PDBSymbolCompiland;
21 class PDBSymbolExe;
22 
23 /// IPDBSession defines an interface used to provide a context for querying
24 /// debug information from a debug data source (for example, a PDB).
25 class IPDBSession {
26 public:
27  virtual ~IPDBSession();
28 
29  virtual uint64_t getLoadAddress() const = 0;
30  virtual bool setLoadAddress(uint64_t Address) = 0;
31  virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() = 0;
32  virtual std::unique_ptr<PDBSymbol>
33  getSymbolById(SymIndexId SymbolId) const = 0;
34 
35  virtual bool addressForVA(uint64_t VA, uint32_t &Section,
36  uint32_t &Offset) const = 0;
37  virtual bool addressForRVA(uint32_t RVA, uint32_t &Section,
38  uint32_t &Offset) const = 0;
39 
40  template <typename T>
41  std::unique_ptr<T> getConcreteSymbolById(SymIndexId SymbolId) const {
42  return unique_dyn_cast_or_null<T>(getSymbolById(SymbolId));
43  }
44 
45  virtual std::unique_ptr<PDBSymbol>
46  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;
47  virtual std::unique_ptr<PDBSymbol>
48  findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;
49  virtual std::unique_ptr<PDBSymbol>
51  PDB_SymType Type) const = 0;
52 
53  virtual std::unique_ptr<IPDBEnumLineNumbers>
55  const IPDBSourceFile &File) const = 0;
56  virtual std::unique_ptr<IPDBEnumLineNumbers>
57  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const = 0;
58  virtual std::unique_ptr<IPDBEnumLineNumbers>
59  findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const = 0;
60  virtual std::unique_ptr<IPDBEnumLineNumbers>
62  uint32_t Length) const = 0;
63 
64  virtual std::unique_ptr<IPDBEnumSourceFiles>
65  findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
66  PDB_NameSearchFlags Flags) const = 0;
67  virtual std::unique_ptr<IPDBSourceFile>
68  findOneSourceFile(const PDBSymbolCompiland *Compiland,
69  llvm::StringRef Pattern,
70  PDB_NameSearchFlags Flags) const = 0;
71  virtual std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
73  PDB_NameSearchFlags Flags) const = 0;
74  virtual std::unique_ptr<PDBSymbolCompiland>
76  PDB_NameSearchFlags Flags) const = 0;
77 
78  virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
79  virtual std::unique_ptr<IPDBEnumSourceFiles>
80  getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
81  virtual std::unique_ptr<IPDBSourceFile>
82  getSourceFileById(uint32_t FileId) const = 0;
83 
84  virtual std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const = 0;
85 
86  virtual std::unique_ptr<IPDBEnumTables> getEnumTables() const = 0;
87 
88  virtual std::unique_ptr<IPDBEnumInjectedSources>
89  getInjectedSources() const = 0;
90 
91  virtual std::unique_ptr<IPDBEnumSectionContribs>
92  getSectionContribs() const = 0;
93 
94  virtual std::unique_ptr<IPDBEnumFrameData>
95  getFrameData() const = 0;
96 };
97 } // namespace pdb
98 } // namespace llvm
99 
100 #endif
virtual std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Sect, uint32_t Offset, PDB_SymType Type) const =0
virtual std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const =0
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
Definition: IPDBSession.h:25
This class represents lattice values for constants.
Definition: AllocatorList.h:23
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:100
virtual bool setLoadAddress(uint64_t Address)=0
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
virtual uint64_t getLoadAddress() const =0
virtual std::unique_ptr< IPDBEnumTables > getEnumTables() const =0
virtual std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const =0
virtual std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const =0
virtual std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const =0
virtual std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const =0
virtual std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const =0
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:241
virtual std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const =0
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
Instrumentation for Order File
virtual std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const =0
std::unique_ptr< T > getConcreteSymbolById(SymIndexId SymbolId) const
Definition: IPDBSession.h:41
virtual std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const =0
virtual std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const =0
virtual bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const =0
virtual std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const =0
virtual std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const =0
virtual std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const =0
virtual std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const =0
virtual std::unique_ptr< PDBSymbolExe > getGlobalScope()=0
virtual bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const =0
virtual std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const =0
virtual std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const =0
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
virtual std::unique_ptr< IPDBEnumFrameData > getFrameData() const =0
virtual std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const =0