LLVM  7.0.0
DIASession.h
Go to the documentation of this file.
1 //===- DIASession.h - DIA 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_DIA_DIASESSION_H
11 #define LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
12 
13 #include "DIASupport.h"
15 #include "llvm/Support/Error.h"
16 
17 #include <system_error>
18 
19 namespace llvm {
20 class StringRef;
21 
22 namespace pdb {
23 class DIASession : public IPDBSession {
24 public:
25  explicit DIASession(CComPtr<IDiaSession> DiaSession);
26 
27  static Error createFromPdb(StringRef Path,
28  std::unique_ptr<IPDBSession> &Session);
29  static Error createFromExe(StringRef Path,
30  std::unique_ptr<IPDBSession> &Session);
31 
32  uint64_t getLoadAddress() const override;
33  bool setLoadAddress(uint64_t Address) override;
34  std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
35  std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const override;
36 
37  bool addressForVA(uint64_t VA, uint32_t &Section,
38  uint32_t &Offset) const override;
39  bool addressForRVA(uint32_t RVA, uint32_t &Section,
40  uint32_t &Offset) const override;
41 
42  std::unique_ptr<PDBSymbol>
43  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
44  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
45  PDB_SymType Type) const override;
46  std::unique_ptr<PDBSymbol>
48  PDB_SymType Type) const override;
49 
50  std::unique_ptr<IPDBEnumLineNumbers>
52  const IPDBSourceFile &File) const override;
53  std::unique_ptr<IPDBEnumLineNumbers>
54  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override;
55  std::unique_ptr<IPDBEnumLineNumbers>
56  findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override;
57  std::unique_ptr<IPDBEnumLineNumbers>
59  uint32_t Length) const override;
60 
61  std::unique_ptr<IPDBEnumSourceFiles>
62  findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
63  PDB_NameSearchFlags Flags) const override;
64  std::unique_ptr<IPDBSourceFile>
65  findOneSourceFile(const PDBSymbolCompiland *Compiland,
66  llvm::StringRef Pattern,
67  PDB_NameSearchFlags Flags) const override;
68  std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
70  PDB_NameSearchFlags Flags) const override;
71  std::unique_ptr<PDBSymbolCompiland>
73  PDB_NameSearchFlags Flags) const override;
74  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
75  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
76  const PDBSymbolCompiland &Compiland) const override;
77  std::unique_ptr<IPDBSourceFile>
78  getSourceFileById(uint32_t FileId) const override;
79 
80  std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
81 
82  std::unique_ptr<IPDBEnumTables> getEnumTables() const override;
83 
84  std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
85 
86  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
87 
88 private:
89  CComPtr<IDiaSession> Session;
90 };
91 } // namespace pdb
92 } // namespace llvm
93 #endif
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override
Definition: DIASession.cpp:272
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
Definition: IPDBSession.h:26
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
Definition: DIASession.cpp:157
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:97
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
Definition: DIASession.cpp:404
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override
Definition: DIASession.cpp:201
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:323
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
Definition: DIASession.cpp:362
bool setLoadAddress(uint64_t Address) override
Definition: DIASession.cpp:153
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:291
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:96
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
Definition: DIASession.cpp:281
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:313
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: DIASession.cpp:258
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:179
std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const override
Definition: DIASession.cpp:217
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: DIASession.cpp:348
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:46
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
Definition: DIASession.cpp:340
DIASession(CComPtr< IDiaSession > DiaSession)
Definition: DIASession.cpp:94
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: DIASession.cpp:243
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
Definition: DIASession.cpp:180
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: DIASession.cpp:370
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:332
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Section, uint32_t Offset, PDB_SymType Type) const override
Definition: DIASession.cpp:230
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
Definition: DIASession.cpp:414
std::unique_ptr< PDBSymbol > getSymbolById(uint32_t SymbolId) const override
Definition: DIASession.cpp:191
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
Definition: DIASession.cpp:378
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:122
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
Definition: DIASession.cpp:169
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
uint64_t getLoadAddress() const override
Definition: DIASession.cpp:147