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"
14#include "llvm/DebugInfo/PDB/IPDBSession.h"
15#include "llvm/Support/Error.h"
16
17#include <system_error>
18
19namespace llvm {
20class StringRef;
21
22namespace pdb {
23class DIASession : public IPDBSession {
24public:
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  void 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  std::unique_ptr<PDBSymbol>
38  findSymbolByAddress(uint64_t Address, PDB_SymType Type) const override;
39
40  std::unique_ptr<IPDBEnumLineNumbers>
41  findLineNumbers(const PDBSymbolCompiland &Compiland,
42                  const IPDBSourceFile &File) const override;
43  std::unique_ptr<IPDBEnumLineNumbers>
44  findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override;
45
46  std::unique_ptr<IPDBEnumSourceFiles>
47  findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
48                  PDB_NameSearchFlags Flags) const override;
49  std::unique_ptr<IPDBSourceFile>
50  findOneSourceFile(const PDBSymbolCompiland *Compiland,
51                    llvm::StringRef Pattern,
52                    PDB_NameSearchFlags Flags) const override;
53  std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
54  findCompilandsForSourceFile(llvm::StringRef Pattern,
55                              PDB_NameSearchFlags Flags) const override;
56  std::unique_ptr<PDBSymbolCompiland>
57  findOneCompilandForSourceFile(llvm::StringRef Pattern,
58                                PDB_NameSearchFlags Flags) const override;
59  std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
60  std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
61      const PDBSymbolCompiland &Compiland) const override;
62  std::unique_ptr<IPDBSourceFile>
63  getSourceFileById(uint32_t FileId) const override;
64
65  std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
66
67private:
68  CComPtr<IDiaSession> Session;
69};
70}
71}
72#endif
73