PDBContext.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- PDBContext.h --------------------------------------------*- 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_PDBCONTEXT_H
  14. #define LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
  15. #include "llvm/DebugInfo/DIContext.h"
  16. #include "llvm/DebugInfo/PDB/IPDBSession.h"
  17. #include <cstdint>
  18. #include <memory>
  19. #include <string>
  20. namespace llvm {
  21. namespace object {
  22. class COFFObjectFile;
  23. } // end namespace object
  24. namespace pdb {
  25. /// PDBContext
  26. /// This data structure is the top level entity that deals with PDB debug
  27. /// information parsing. This data structure exists only when there is a
  28. /// need for a transparent interface to different debug information formats
  29. /// (e.g. PDB and DWARF). More control and power over the debug information
  30. /// access can be had by using the PDB interfaces directly.
  31. class PDBContext : public DIContext {
  32. public:
  33. PDBContext(const object::COFFObjectFile &Object,
  34. std::unique_ptr<IPDBSession> PDBSession);
  35. PDBContext(PDBContext &) = delete;
  36. PDBContext &operator=(PDBContext &) = delete;
  37. static bool classof(const DIContext *DICtx) {
  38. return DICtx->getKind() == CK_PDB;
  39. }
  40. void dump(raw_ostream &OS, DIDumpOptions DIDumpOpts) override;
  41. DILineInfo getLineInfoForAddress(
  42. object::SectionedAddress Address,
  43. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  44. DILineInfoTable getLineInfoForAddressRange(
  45. object::SectionedAddress Address, uint64_t Size,
  46. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  47. DIInliningInfo getInliningInfoForAddress(
  48. object::SectionedAddress Address,
  49. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  50. std::vector<DILocal>
  51. getLocalsForAddress(object::SectionedAddress Address) override;
  52. private:
  53. std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
  54. std::unique_ptr<IPDBSession> Session;
  55. };
  56. } // end namespace pdb
  57. } // end namespace llvm
  58. #endif // LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
  59. #ifdef __GNUC__
  60. #pragma GCC diagnostic pop
  61. #endif