DebuggerSupportPlugin.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- DebugerSupportPlugin.h -- Utils for debugger support ---*- 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. //
  14. // Generates debug objects and registers them using the jit-loader-gdb protocol.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
  18. #define LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
  19. #include "llvm/ExecutionEngine/Orc/Core.h"
  20. #include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
  21. #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
  22. namespace llvm {
  23. namespace orc {
  24. /// For each object containing debug info, installs JITLink passes to synthesize
  25. /// a debug object and then register it via the GDB JIT-registration interface.
  26. ///
  27. /// Currently MachO only. For ELF use DebugObjectManagerPlugin. These two
  28. /// plugins will be merged in the near future.
  29. class GDBJITDebugInfoRegistrationPlugin : public ObjectLinkingLayer::Plugin {
  30. public:
  31. class DebugSectionSynthesizer {
  32. public:
  33. virtual ~DebugSectionSynthesizer() = default;
  34. virtual Error startSynthesis() = 0;
  35. virtual Error completeSynthesisAndRegister() = 0;
  36. };
  37. static Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>>
  38. Create(ExecutionSession &ES, JITDylib &ProcessJD, const Triple &TT);
  39. GDBJITDebugInfoRegistrationPlugin(ExecutorAddr RegisterActionAddr)
  40. : RegisterActionAddr(RegisterActionAddr) {}
  41. Error notifyFailed(MaterializationResponsibility &MR) override;
  42. Error notifyRemovingResources(ResourceKey K) override;
  43. void notifyTransferringResources(ResourceKey DstKey,
  44. ResourceKey SrcKey) override;
  45. void modifyPassConfig(MaterializationResponsibility &MR,
  46. jitlink::LinkGraph &LG,
  47. jitlink::PassConfiguration &PassConfig) override;
  48. private:
  49. void modifyPassConfigForMachO(MaterializationResponsibility &MR,
  50. jitlink::LinkGraph &LG,
  51. jitlink::PassConfiguration &PassConfig);
  52. ExecutorAddr RegisterActionAddr;
  53. };
  54. } // namespace orc
  55. } // namespace llvm
  56. #endif // LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
  57. #ifdef __GNUC__
  58. #pragma GCC diagnostic pop
  59. #endif