LLVM  14.0.0git
DIASession.h
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 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
10 #define LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
11 
12 #include "DIASupport.h"
14 #include "llvm/Support/Error.h"
15 
16 #include <system_error>
17 
18 namespace llvm {
19 class StringRef;
20 
21 namespace pdb {
22 class DIASession : public IPDBSession {
23 public:
24  explicit DIASession(CComPtr<IDiaSession> DiaSession);
25 
26  static Error createFromPdb(StringRef Path,
27  std::unique_ptr<IPDBSession> &Session);
28  static Error createFromExe(StringRef Path,
29  std::unique_ptr<IPDBSession> &Session);
30 
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;
35 
37  uint32_t &Offset) const override;
39  uint32_t &Offset) const override;
40 
41  std::unique_ptr<PDBSymbol> findSymbolByAddress(uint64_t Address,
42  PDB_SymType Type) override;
43  std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
44  PDB_SymType Type) override;
45  std::unique_ptr<PDBSymbol> findSymbolBySectOffset(uint32_t Section,
47  PDB_SymType Type) override;
48 
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;
59 
60  std::unique_ptr<IPDBEnumSourceFiles>
62  PDB_NameSearchFlags Flags) const override;
63  std::unique_ptr<IPDBSourceFile>
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;
78 
79  std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
80 
81  std::unique_ptr<IPDBEnumTables> getEnumTables() const override;
82 
83  std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
84 
85  std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
86 
87  std::unique_ptr<IPDBEnumFrameData> getFrameData() const override;
88 private:
89  CComPtr<IDiaSession> Session;
90 };
91 } // namespace pdb
92 } // namespace llvm
93 #endif
llvm::pdb::IPDBSession
IPDBSession defines an interface used to provide a context for querying debug information from a debu...
Definition: IPDBSession.h:25
DIASupport.h
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AllocatorList.h:23
llvm::pdb::DIASession::getLoadAddress
uint64_t getLoadAddress() const override
Definition: DIASession.cpp:138
llvm::pdb::IPDBSourceFile
IPDBSourceFile defines an interface used to represent source files whose information are stored in th...
Definition: IPDBSourceFile.h:23
Error.h
llvm::pdb::DIASession::getSymbolById
std::unique_ptr< PDBSymbol > getSymbolById(SymIndexId SymbolId) const override
Definition: DIASession.cpp:183
llvm::pdb::DIASession
Definition: DIASession.h:22
llvm::pdb::DIASession::findSymbolByRVA
std::unique_ptr< PDBSymbol > findSymbolByRVA(uint32_t RVA, PDB_SymType Type) override
Definition: DIASession.cpp:209
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
Offset
uint64_t Offset
Definition: ELFObjHandler.cpp:81
llvm::pdb::PDB_SymType
PDB_SymType
These values correspond to the SymTagEnum enumeration, and are documented here: https://msdn....
Definition: PDBTypes.h:243
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:82
llvm::pdb::DIASession::createFromExe
static Error createFromExe(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:113
llvm::pdb::DIASession::findLineNumbersBySectOffset
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset, uint32_t Length) const override
Definition: DIASession.cpp:273
llvm::pdb::DIASession::findOneSourceFile
std::unique_ptr< IPDBSourceFile > findOneSourceFile(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:305
llvm::pdb::PDB_NameSearchFlags
PDB_NameSearchFlags
Defines flags used for enumerating child symbols.
Definition: PDBTypes.h:102
llvm::pdb::DIASession::getGlobalScope
std::unique_ptr< PDBSymbolExe > getGlobalScope() override
Definition: DIASession.cpp:148
llvm::pdb::DIASession::findCompilandsForSourceFile
std::unique_ptr< IPDBEnumChildren< PDBSymbolCompiland > > findCompilandsForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:315
llvm::pdb::DIASession::DIASession
DIASession(CComPtr< IDiaSession > DiaSession)
Definition: DIASession.cpp:85
llvm::pdb::DIASession::getInjectedSources
std::unique_ptr< IPDBEnumInjectedSources > getInjectedSources() const override
Definition: DIASession.cpp:396
uint64_t
llvm::pdb::DIASession::createFromPdb
static Error createFromPdb(StringRef Path, std::unique_ptr< IPDBSession > &Session)
Definition: DIASession.cpp:87
IPDBSession.h
llvm::pdb::DIASession::findLineNumbersByAddress
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override
Definition: DIASession.cpp:250
llvm::pdb::DIASession::findLineNumbers
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbers(const PDBSymbolCompiland &Compiland, const IPDBSourceFile &File) const override
Definition: DIASession.cpp:235
llvm::HighlightColor::Address
@ Address
llvm::pdb::DIASession::getSourceFileById
std::unique_ptr< IPDBSourceFile > getSourceFileById(uint32_t FileId) const override
Definition: DIASession.cpp:354
llvm::pdb::DIASession::setLoadAddress
bool setLoadAddress(uint64_t Address) override
Definition: DIASession.cpp:144
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::pdb::DIASession::getEnumTables
std::unique_ptr< IPDBEnumTables > getEnumTables() const override
Definition: DIASession.cpp:370
uint32_t
llvm::pdb::DIASession::findLineNumbersByRVA
std::unique_ptr< IPDBEnumLineNumbers > findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override
Definition: DIASession.cpp:264
llvm::pdb::DIASession::getSectionContribs
std::unique_ptr< IPDBEnumSectionContribs > getSectionContribs() const override
Definition: DIASession.cpp:406
llvm::pdb::DIASession::findOneCompilandForSourceFile
std::unique_ptr< PDBSymbolCompiland > findOneCompilandForSourceFile(llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:324
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::pdb::PDB_SymType::Compiland
@ Compiland
llvm::pdb::DIASession::getSourceFilesForCompiland
std::unique_ptr< IPDBEnumSourceFiles > getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const override
Definition: DIASession.cpp:340
llvm::pdb::DIASession::findSymbolBySectOffset
std::unique_ptr< PDBSymbol > findSymbolBySectOffset(uint32_t Section, uint32_t Offset, PDB_SymType Type) override
Definition: DIASession.cpp:222
llvm::Pattern
Definition: FileCheckImpl.h:614
llvm::pdb::DIASession::getDebugStreams
std::unique_ptr< IPDBEnumDataStreams > getDebugStreams() const override
Definition: DIASession.cpp:362
llvm::pdb::DIASession::findSymbolByAddress
std::unique_ptr< PDBSymbol > findSymbolByAddress(uint64_t Address, PDB_SymType Type) override
Definition: DIASession.cpp:192
llvm::pdb::DIASession::getAllSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > getAllSourceFiles() const override
Definition: DIASession.cpp:332
llvm::pdb::PDBSymbolCompiland
Definition: PDBSymbolCompiland.h:21
llvm::pdb::DIASession::addressForVA
bool addressForVA(uint64_t VA, uint32_t &Section, uint32_t &Offset) const override
Definition: DIASession.cpp:160
llvm::pdb::DIASession::addressForRVA
bool addressForRVA(uint32_t RVA, uint32_t &Section, uint32_t &Offset) const override
Definition: DIASession.cpp:171
File
Instrumentation for Order File
Definition: InstrOrderFile.cpp:205
llvm::pdb::DIASession::getFrameData
std::unique_ptr< IPDBEnumFrameData > getFrameData() const override
Definition: DIASession.cpp:416
llvm::pdb::DIASession::findSourceFiles
std::unique_ptr< IPDBEnumSourceFiles > findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern, PDB_NameSearchFlags Flags) const override
Definition: DIASession.cpp:283