xref: /freebsd/contrib/llvm-project/llvm/include/llvm/DebugInfo/PDB/DIA/DIASession.h (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
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"
13 #include "llvm/DebugInfo/PDB/IPDBSession.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 
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;
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,
46                                                     uint32_t Offset,
47                                                     PDB_SymType Type) override;
48 
49   std::unique_ptr<IPDBEnumLineNumbers>
50   findLineNumbers(const PDBSymbolCompiland &Compiland,
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>
57   findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
58                               uint32_t Length) const override;
59 
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>>
68   findCompilandsForSourceFile(llvm::StringRef Pattern,
69                               PDB_NameSearchFlags Flags) const override;
70   std::unique_ptr<PDBSymbolCompiland>
71   findOneCompilandForSourceFile(llvm::StringRef Pattern,
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
94