LLVM  10.0.0svn
Go to the documentation of this file.
1 //===- DIASession.h - DIA implementation of IPDBSession ---------*- 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 //===----------------------------------------------------------------------===//
12 #include "DIASupport.h"
14 #include "llvm/Support/Error.h"
16 #include <system_error>
18 namespace llvm {
19 class StringRef;
21 namespace pdb {
22 class DIASession : public IPDBSession {
23 public:
24  explicit DIASession(CComPtr<IDiaSession> DiaSession);
26  static Error createFromPdb(StringRef Path,
27  std::unique_ptr<IPDBSession> &Session);
28  static Error createFromExe(StringRef Path,
29  std::unique_ptr<IPDBSession> &Session);
31  uint64_t getLoadAddress() const override;
32  bool setLoadAddress(uint64_t Address) override;
33  std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
34  std::unique_ptr<PDBSymbol> getSymbolById(SymIndexId SymbolId) const override;
36  bool addressForVA(uint64_t VA, uint32_t &Section,
37  uint32_t &Offset) const override;
38  bool addressForRVA(uint32_t RVA, uint32_t &Section,
39  uint32_t &Offset) const override;
41  std::unique_ptr<PDBSymbol>
42  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
43  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
44  PDB_SymType Type) const override;
45  std::unique_ptr<PDBSymbol>
47  PDB_SymType Type) const override;
49  std::unique_ptr<IPDBEnumLineNumbers>
51  const IPDBSourceFile &File) const override;
52  std::unique_ptr<IPDBEnumLineNumbers>
53  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override;
54  std::unique_ptr<IPDBEnumLineNumbers>
55  findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override;
56  std::unique_ptr<IPDBEnumLineNumbers>
58  uint32_t Length) const override;
60  std::unique_ptr<IPDBEnumSourceFiles>
61  findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
62  PDB_NameSearchFlags Flags) const override;
63  std::unique_ptr<IPDBSourceFile>
64  findOneSourceFile(const PDBSymbolCompiland *Compiland,
65  llvm::StringRef Pattern,
66  PDB_NameSearchFlags Flags) const override;
67  std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
69  PDB_NameSearchFlags Flags) const override;
70  std::unique_ptr<PDBSymbolCompiland>
72  PDB_NameSearchFlags Flags) const override;
73  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
74  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
75  const PDBSymbolCompiland &Compiland) const override;
76  std::unique_ptr<IPDBSourceFile>
77  getSourceFileById(uint32_t FileId) const override;
79  std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
81  std::unique_ptr<IPDBEnumTables> getEnumTables() const override;
83  std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
85  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
87  std::unique_ptr<IPDBEnumFrameData> getFrameData() const override;
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:264
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
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
Definition: DIASession.cpp:148
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:100
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
Definition: DIASession.cpp:396
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override
Definition: DIASession.cpp:193
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:315
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:354
bool setLoadAddress(uint64_t Address) override
Definition: DIASession.cpp:144
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const override
Definition: DIASession.cpp:183
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:283
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:87
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
Definition: DIASession.cpp:273
std::unique_ptr< IPDBEnumFrameData > getFrameData() const override
Definition: DIASession.cpp:416
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:305
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: DIASession.cpp:250
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn.microsoft.com/en-us/library/bkedss5f.aspx.
Definition: PDBTypes.h:241
std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const override
Definition: DIASession.cpp:209
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: DIASession.cpp:340
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:332
Instrumentation for Order File
DIASession(CComPtr< IDiaSession > DiaSession)
Definition: DIASession.cpp:85
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: DIASession.cpp:235
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
Definition: DIASession.cpp:171
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: DIASession.cpp:362
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:324
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Section, uint32_t Offset, PDB_SymType Type) const override
Definition: DIASession.cpp:222
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
Definition: DIASession.cpp:406
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
Definition: DIASession.cpp:370
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:113
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:160
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
uint64_t getLoadAddress() const override
Definition: DIASession.cpp:138