File indexing completed on 2026-05-10 08:43:52
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_DEBUGOBJECTMANAGERPLUGIN_H
0014 #define LLVM_EXECUTIONENGINE_ORC_DEBUGOBJECTMANAGERPLUGIN_H
0015
0016 #include "llvm/ExecutionEngine/JITLink/JITLink.h"
0017 #include "llvm/ExecutionEngine/Orc/Core.h"
0018 #include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
0019 #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
0020 #include "llvm/Support/Error.h"
0021 #include "llvm/Support/Memory.h"
0022 #include "llvm/Support/MemoryBufferRef.h"
0023 #include "llvm/TargetParser/Triple.h"
0024
0025 #include <functional>
0026 #include <map>
0027 #include <memory>
0028 #include <mutex>
0029
0030 namespace llvm {
0031 namespace orc {
0032
0033 class DebugObject;
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 class DebugObjectManagerPlugin : public ObjectLinkingLayer::Plugin {
0049 public:
0050
0051 DebugObjectManagerPlugin(ExecutionSession &ES,
0052 std::unique_ptr<DebugObjectRegistrar> Target);
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069 DebugObjectManagerPlugin(ExecutionSession &ES,
0070 std::unique_ptr<DebugObjectRegistrar> Target,
0071 bool RequireDebugSections, bool AutoRegisterCode);
0072 ~DebugObjectManagerPlugin();
0073
0074 void notifyMaterializing(MaterializationResponsibility &MR,
0075 jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx,
0076 MemoryBufferRef InputObject) override;
0077
0078 Error notifyEmitted(MaterializationResponsibility &MR) override;
0079 Error notifyFailed(MaterializationResponsibility &MR) override;
0080 Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override;
0081
0082 void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey,
0083 ResourceKey SrcKey) override;
0084
0085 void modifyPassConfig(MaterializationResponsibility &MR,
0086 jitlink::LinkGraph &LG,
0087 jitlink::PassConfiguration &PassConfig) override;
0088
0089 private:
0090 ExecutionSession &ES;
0091
0092 using OwnedDebugObject = std::unique_ptr<DebugObject>;
0093 std::map<MaterializationResponsibility *, OwnedDebugObject> PendingObjs;
0094 std::map<ResourceKey, std::vector<OwnedDebugObject>> RegisteredObjs;
0095
0096 std::mutex PendingObjsLock;
0097 std::mutex RegisteredObjsLock;
0098
0099 std::unique_ptr<DebugObjectRegistrar> Target;
0100 bool RequireDebugSections;
0101 bool AutoRegisterCode;
0102 };
0103
0104 }
0105 }
0106
0107 #endif