IPDBSession.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef LLVM_DEBUGINFO_PDB_IPDBSESSION_H
  10. #define LLVM_DEBUGINFO_PDB_IPDBSESSION_H
  11. #include "PDBTypes.h"
  12. #include "llvm/Support/Casting.h"
  13. #include <memory>
  14. namespace llvm {
  15. class PDBSymbolCompiland;
  16. class PDBSymbolExe;
  17. /// IPDBSession defines an interface used to provide a context for querying
  18. /// debug information from a debug data source (for example, a PDB).
  19. class IPDBSession {
  20. public:
  21. virtual ~IPDBSession();
  22. virtual uint64_t getLoadAddress() const = 0;
  23. virtual void setLoadAddress(uint64_t Address) = 0;
  24. virtual std::unique_ptr<PDBSymbolExe> getGlobalScope() const = 0;
  25. virtual std::unique_ptr<PDBSymbol> getSymbolById(uint32_t SymbolId) const = 0;
  26. template <typename T>
  27. std::unique_ptr<T> getConcreteSymbolById(uint32_t SymbolId) const {
  28. auto Symbol(getSymbolById(SymbolId));
  29. if (!Symbol)
  30. return nullptr;
  31. T *ConcreteSymbol = dyn_cast<T>(Symbol.get());
  32. if (!ConcreteSymbol)
  33. return nullptr;
  34. Symbol.release();
  35. return std::unique_ptr<T>(ConcreteSymbol);
  36. }
  37. virtual std::unique_ptr<PDBSymbol>
  38. findSymbolByAddress(uint64_t Address, PDB_SymType Type) const = 0;
  39. virtual std::unique_ptr<IPDBEnumLineNumbers>
  40. findLineNumbersByAddress(uint64_t Address, uint32_t Length) const = 0;
  41. virtual std::unique_ptr<IPDBEnumSourceFiles> getAllSourceFiles() const = 0;
  42. virtual std::unique_ptr<IPDBEnumSourceFiles>
  43. getSourceFilesForCompiland(const PDBSymbolCompiland &Compiland) const = 0;
  44. virtual std::unique_ptr<IPDBSourceFile>
  45. getSourceFileById(uint32_t FileId) const = 0;
  46. virtual std::unique_ptr<IPDBEnumDataStreams> getDebugStreams() const = 0;
  47. };
  48. }
  49. #endif