PDBContext.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. //===-- PDBContext.h --------------------------------------------*- 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_PDBCONTEXT_H
  10. #define LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
  11. #include "llvm/DebugInfo/DIContext.h"
  12. #include "llvm/DebugInfo/PDB/IPDBSession.h"
  13. namespace llvm {
  14. namespace object {
  15. class COFFObjectFile;
  16. }
  17. /// PDBContext
  18. /// This data structure is the top level entity that deals with PDB debug
  19. /// information parsing. This data structure exists only when there is a
  20. /// need for a transparent interface to different debug information formats
  21. /// (e.g. PDB and DWARF). More control and power over the debug information
  22. /// access can be had by using the PDB interfaces directly.
  23. class PDBContext : public DIContext {
  24. PDBContext(PDBContext &) = delete;
  25. PDBContext &operator=(PDBContext &) = delete;
  26. public:
  27. PDBContext(const object::COFFObjectFile &Object,
  28. std::unique_ptr<IPDBSession> PDBSession,
  29. bool RelativeAddress);
  30. static bool classof(const DIContext *DICtx) {
  31. return DICtx->getKind() == CK_PDB;
  32. }
  33. void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All) override;
  34. DILineInfo getLineInfoForAddress(
  35. uint64_t Address,
  36. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  37. DILineInfoTable getLineInfoForAddressRange(
  38. uint64_t Address, uint64_t Size,
  39. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  40. DIInliningInfo getInliningInfoForAddress(
  41. uint64_t Address,
  42. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  43. private:
  44. std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
  45. std::unique_ptr<IPDBSession> Session;
  46. };
  47. }
  48. #endif