DIASession.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- DIASession.h - DIA implementation of IPDBSession ---------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
  14. #define LLVM_DEBUGINFO_PDB_DIA_DIASESSION_H
  15. #include "DIASupport.h"
  16. #include "llvm/DebugInfo/PDB/IPDBSession.h"
  17. #include "llvm/Support/Error.h"
  18. #include <system_error>
  19. namespace llvm {
  20. class StringRef;
  21. namespace pdb {
  22. class DIASession : public IPDBSession {
  23. public:
  24. explicit DIASession(CComPtr<IDiaSession> DiaSession);
  25. static Error createFromPdb(StringRef Path,
  26. std::unique_ptr<IPDBSession> &Session);
  27. static Error createFromExe(StringRef Path,
  28. std::unique_ptr<IPDBSession> &Session);
  29. uint64_t getLoadAddress() const override;
  30. bool setLoadAddress(uint64_t Address) override;
  31. std::unique_ptr<PDBSymbolExe> getGlobalScope() override;
  32. std::unique_ptr<PDBSymbol> getSymbolById(SymIndexId SymbolId) const override;
  33. bool addressForVA(uint64_t VA, uint32_t &Section,
  34. uint32_t &Offset) const override;
  35. bool addressForRVA(uint32_t RVA, uint32_t &Section,
  36. uint32_t &Offset) const override;
  37. std::unique_ptr<PDBSymbol> findSymbolByAddress(uint64_t Address,
  38. PDB_SymType Type) override;
  39. std::unique_ptr<PDBSymbol> findSymbolByRVA(uint32_t RVA,
  40. PDB_SymType Type) override;
  41. std::unique_ptr<PDBSymbol> findSymbolBySectOffset(uint32_t Section,
  42. uint32_t Offset,
  43. PDB_SymType Type) override;
  44. std::unique_ptr<IPDBEnumLineNumbers>
  45. findLineNumbers(const PDBSymbolCompiland &Compiland,
  46. const IPDBSourceFile &File) const override;
  47. std::unique_ptr<IPDBEnumLineNumbers>
  48. findLineNumbersByAddress(uint64_t Address, uint32_t Length) const override;
  49. std::unique_ptr<IPDBEnumLineNumbers>
  50. findLineNumbersByRVA(uint32_t RVA, uint32_t Length) const override;
  51. std::unique_ptr<IPDBEnumLineNumbers>
  52. findLineNumbersBySectOffset(uint32_t Section, uint32_t Offset,
  53. uint32_t Length) const override;
  54. std::unique_ptr<IPDBEnumSourceFiles>
  55. findSourceFiles(const PDBSymbolCompiland *Compiland, llvm::StringRef Pattern,
  56. PDB_NameSearchFlags Flags) const override;
  57. std::unique_ptr<IPDBSourceFile>
  58. findOneSourceFile(const PDBSymbolCompiland *Compiland,
  59. llvm::StringRef Pattern,
  60. PDB_NameSearchFlags Flags) const override;
  61. std::unique_ptr<IPDBEnumChildren<PDBSymbolCompiland>>
  62. findCompilandsForSourceFile(llvm::StringRef Pattern,
  63. PDB_NameSearchFlags Flags) const override;
  64. std::unique_ptr<PDBSymbolCompiland>
  65. findOneCompilandForSourceFile(llvm::StringRef Pattern,
  66. PDB_NameSearchFlags Flags) const override;
  67. std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const override;
  68. std::unique_ptr<IPDBEnumSourceFiles> getSourceFilesForCompiland(
  69. const PDBSymbolCompiland &Compiland) const override;
  70. std::unique_ptr<IPDBSourceFile>
  71. getSourceFileById(uint32_t FileId) const override;
  72. std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const override;
  73. std::unique_ptr<IPDBEnumTables> getEnumTables() const override;
  74. std::unique_ptr<IPDBEnumInjectedSources> getInjectedSources() const override;
  75. std::unique_ptr<IPDBEnumSectionContribs> getSectionContribs() const override;
  76. std::unique_ptr<IPDBEnumFrameData> getFrameData() const override;
  77. private:
  78. CComPtr<IDiaSession> Session;
  79. };
  80. } // namespace pdb
  81. } // namespace llvm
  82. #endif
  83. #ifdef __GNUC__
  84. #pragma GCC diagnostic pop
  85. #endif