Line data Source code
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 "PDBSymbol.h"
14 : #include "PDBTypes.h"
15 : #include "llvm/ADT/StringRef.h"
16 : #include "llvm/Support/Casting.h"
17 : #include <memory>
18 :
19 : namespace llvm {
20 : namespace pdb {
21 : class PDBSymbolCompiland;
22 : class PDBSymbolExe;
23 :
24 : /// IPDBSession defines an interface used to provide a context for querying
25 : /// debug information from a debug data source (for example, a PDB).
26 125 : class IPDBSession {
27 : public:
28 : virtual ~IPDBSession();
29 :
30 : virtual uint64_t getLoadAddress() const = 0;
31 : virtual bool setLoadAddress(uint64_t Address) = 0;
32 : virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() = 0;
33 : virtual std::unique_ptr<PDBSymbol>
34 : getSymbolById(SymIndexId SymbolId) const = 0;
35 :
36 : virtual bool addressForVA(uint64_t VA, uint32_t &Section,
37 : uint32_t &Offset) const = 0;
38 : virtual bool addressForRVA(uint32_t RVA, uint32_t &Section,
39 : uint32_t &Offset) const = 0;
40 :
41 : template <typename T>
42 177 : std::unique_ptr<T> getConcreteSymbolById(SymIndexId SymbolId) const {
43 177 : return unique_dyn_cast_or_null<T>(getSymbolById(SymbolId));
44 : }
45 :
46 : virtual std::unique_ptr<PDBSymbol>
47 : findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;
48 : virtual std::unique_ptr<PDBSymbol>
49 : findSymbolByRVA(uint32_t RVA, PDB_SymType Type) const = 0;
50 : virtual std::unique_ptr<PDBSymbol>
51 : findSymbolBySectOffset(uint32_t Sect, uint32_t Offset,
52 : PDB_SymType Type) const = 0;
53 :
54 : virtual std::unique_ptr<IPDBEnumLineNumbers>
55 : findLineNumbers(const PDBSymbolCompiland &Compiland,
56 : const IPDBSourceFile &File) const = 0;
57 : virtual std::unique_ptr<IPDBEnumLineNumbers>
58 : findLineNumbersByAddress(uint64_t Address, uint32_t Length) const = 0;
59 : virtual std::unique_ptr<IPDBEnumLineNumbers>
60 : findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const = 0;
61 : virtual std::unique_ptr<IPDBEnumLineNumbers>
62 : findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
63 : uint32_t Length) const = 0;
64 :
65 : virtual std::unique_ptr<IPDBEnumSourceFiles>
66 : findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
67 : PDB_NameSearchFlags Flags) const = 0;
68 : virtual std::unique_ptr<IPDBSourceFile>
69 : findOneSourceFile(const PDBSymbolCompiland *Compiland,
70 : llvm::StringRef Pattern,
71 : PDB_NameSearchFlags Flags) const = 0;
72 : virtual std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
73 : findCompilandsForSourceFile(llvm::StringRef Pattern,
74 : PDB_NameSearchFlags Flags) const = 0;
75 : virtual std::unique_ptr<PDBSymbolCompiland>
76 : findOneCompilandForSourceFile(llvm::StringRef Pattern,
77 : PDB_NameSearchFlags Flags) const = 0;
78 :
79 : virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
80 : virtual std::unique_ptr<IPDBEnumSourceFiles>
81 : getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
82 : virtual std::unique_ptr<IPDBSourceFile>
83 : getSourceFileById(uint32_t FileId) const = 0;
84 :
85 : virtual std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const = 0;
86 :
87 : virtual std::unique_ptr<IPDBEnumTables> getEnumTables() const = 0;
88 :
89 : virtual std::unique_ptr<IPDBEnumInjectedSources>
90 : getInjectedSources() const = 0;
91 :
92 : virtual std::unique_ptr<IPDBEnumSectionContribs>
93 : getSectionContribs() const = 0;
94 : };
95 : } // namespace pdb
96 : } // namespace llvm
97 :
98 : #endif
|