PDBContext.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. DILineInfo
  45. getLineInfoForDataAddress(object::SectionedAddress Address) override;
  46. DILineInfoTable getLineInfoForAddressRange(
  47. object::SectionedAddress Address, uint64_t Size,
  48. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  49. DIInliningInfo getInliningInfoForAddress(
  50. object::SectionedAddress Address,
  51. DILineInfoSpecifier Specifier = DILineInfoSpecifier()) override;
  52. std::vector<DILocal>
  53. getLocalsForAddress(object::SectionedAddress Address) override;
  54. private:
  55. std::string getFunctionName(uint64_t Address, DINameKind NameKind) const;
  56. std::unique_ptr<IPDBSession> Session;
  57. };
  58. } // end namespace pdb
  59. } // end namespace llvm
  60. #endif // LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
  61. #ifdef __GNUC__
  62. #pragma GCC diagnostic pop
  63. #endif