LLVM  3.7.0
IPDBSession.h
Go to the documentation of this file.
1 //===- IPDBSession.h - base interface for a PDB symbol context --*- 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_IPDBSESSION_H
11 #define LLVM_DEBUGINFO_PDB_IPDBSESSION_H
12 
13 #include "PDBTypes.h"
14 #include "llvm/Support/Casting.h"
15 #include <memory>
16 
17 namespace llvm {
18 
19 class PDBSymbolCompiland;
20 class PDBSymbolExe;
21 
22 /// IPDBSession defines an interface used to provide a context for querying
23 /// debug information from a debug data source (for example, a PDB).
24 class IPDBSession {
25 public:
26  virtual ~IPDBSession();
27 
28  virtual uint64_t getLoadAddress() const = 0;
29  virtual void setLoadAddress(uint64_t Address) = 0;
30  virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
31  virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
32 
33  template <typename T>
34  std::unique_ptr<T> getConcreteSymbolById(uint32_t SymbolId) const {
35  auto Symbol(getSymbolById(SymbolId));
36  if (!Symbol)
37  return nullptr;
38 
39  T *ConcreteSymbol = dyn_cast<T>(Symbol.get());
40  if (!ConcreteSymbol)
41  return nullptr;
42  Symbol.release();
43  return std::unique_ptr<T>(ConcreteSymbol);
44  }
45 
46  virtual std::unique_ptr<PDBSymbol>
47  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;
48  virtual std::unique_ptr<IPDBEnumLineNumbers>
49  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const = 0;
50 
51  virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
52  virtual std::unique_ptr<IPDBEnumSourceFiles>
54  virtual std::unique_ptr<IPDBSourceFile>
55  getSourceFileById(uint32_t FileId) const = 0;
56 
57  virtual std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const = 0;
58 };
59 }
60 
61 #endif
virtual std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const =0
virtual std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const =0
virtual std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const =0
virtual std::unique_ptr< PDBSymbolExe > getGlobalScope() const =0
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
virtual std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const =0
virtual uint64_t getLoadAddress() const =0
virtual void setLoadAddress(uint64_t Address)=0
virtual std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const =0
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
Definition: IPDBSession.h:24
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:270
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:285
virtual std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const =0
virtual std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const =0
std::unique_ptr< T > getConcreteSymbolById(uint32_t SymbolId) const
Definition: IPDBSession.h:34