Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:51

0001 //===--- DebugerSupportPlugin.h -- Utils for debugger support ---*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // Generates debug objects and registers them using the jit-loader-gdb protocol.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
0014 #define LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
0015 
0016 #include "llvm/ExecutionEngine/Orc/Core.h"
0017 #include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
0018 #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
0019 
0020 namespace llvm {
0021 namespace orc {
0022 
0023 /// For each object containing debug info, installs JITLink passes to synthesize
0024 /// a debug object and then register it via the GDB JIT-registration interface.
0025 ///
0026 /// Currently MachO only. For ELF use DebugObjectManagerPlugin. These two
0027 /// plugins will be merged in the near future.
0028 class GDBJITDebugInfoRegistrationPlugin : public ObjectLinkingLayer::Plugin {
0029 public:
0030   class DebugSectionSynthesizer {
0031   public:
0032     virtual ~DebugSectionSynthesizer() = default;
0033     virtual Error startSynthesis() = 0;
0034     virtual Error completeSynthesisAndRegister() = 0;
0035   };
0036 
0037   static Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>>
0038   Create(ExecutionSession &ES, JITDylib &ProcessJD, const Triple &TT);
0039 
0040   GDBJITDebugInfoRegistrationPlugin(ExecutorAddr RegisterActionAddr)
0041       : RegisterActionAddr(RegisterActionAddr) {}
0042 
0043   Error notifyFailed(MaterializationResponsibility &MR) override;
0044   Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override;
0045 
0046   void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey,
0047                                    ResourceKey SrcKey) override;
0048 
0049   void modifyPassConfig(MaterializationResponsibility &MR,
0050                         jitlink::LinkGraph &LG,
0051                         jitlink::PassConfiguration &PassConfig) override;
0052 
0053 private:
0054   void modifyPassConfigForMachO(MaterializationResponsibility &MR,
0055                                 jitlink::LinkGraph &LG,
0056                                 jitlink::PassConfiguration &PassConfig);
0057 
0058   ExecutorAddr RegisterActionAddr;
0059 };
0060 
0061 } // namespace orc
0062 } // namespace llvm
0063 
0064 #endif // LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H