1 | //===--- DebugerSupportPlugin.h -- Utils for debugger support ---*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | // |
9 | // Generates debug objects and registers them using the jit-loader-gdb protocol. |
10 | // |
11 | //===----------------------------------------------------------------------===// |
12 | |
13 | #ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H |
14 | #define LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H |
15 | |
16 | #include "llvm/ExecutionEngine/Orc/Core.h" |
17 | #include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h" |
18 | #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h" |
19 | |
20 | namespace llvm { |
21 | namespace orc { |
22 | |
23 | /// For each object containing debug info, installs JITLink passes to synthesize |
24 | /// a debug object and then register it via the GDB JIT-registration interface. |
25 | /// |
26 | /// Currently MachO only. For ELF use DebugObjectManagerPlugin. These two |
27 | /// plugins will be merged in the near future. |
28 | class GDBJITDebugInfoRegistrationPlugin : public ObjectLinkingLayer::Plugin { |
29 | public: |
30 | class DebugSectionSynthesizer { |
31 | public: |
32 | virtual ~DebugSectionSynthesizer() = default; |
33 | virtual Error startSynthesis() = 0; |
34 | virtual Error completeSynthesisAndRegister() = 0; |
35 | }; |
36 | |
37 | static Expected<std::unique_ptr<GDBJITDebugInfoRegistrationPlugin>> |
38 | Create(ExecutionSession &ES, JITDylib &ProcessJD, const Triple &TT); |
39 | |
40 | GDBJITDebugInfoRegistrationPlugin(ExecutorAddr RegisterActionAddr) |
41 | : RegisterActionAddr(RegisterActionAddr) {} |
42 | |
43 | Error notifyFailed(MaterializationResponsibility &MR) override; |
44 | Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override; |
45 | |
46 | void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey, |
47 | ResourceKey SrcKey) override; |
48 | |
49 | void modifyPassConfig(MaterializationResponsibility &MR, |
50 | jitlink::LinkGraph &LG, |
51 | jitlink::PassConfiguration &PassConfig) override; |
52 | |
53 | private: |
54 | void modifyPassConfigForMachO(MaterializationResponsibility &MR, |
55 | jitlink::LinkGraph &LG, |
56 | jitlink::PassConfiguration &PassConfig); |
57 | |
58 | ExecutorAddr RegisterActionAddr; |
59 | }; |
60 | |
61 | } // namespace orc |
62 | } // namespace llvm |
63 | |
64 | #endif // LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H |
65 | |