2323#include " llvm/Support/MemoryBufferRef.h"
2424#include " llvm/TargetParser/Triple.h"
2525
26+ #include < functional>
2627#include < map>
2728#include < memory>
2829#include < mutex>
@@ -32,32 +33,43 @@ namespace orc {
3233
3334class DebugObject ;
3435
35- // / Debugger support for ELF platforms with the GDB JIT Interface. The plugin
36- // / emits and manages a separate debug object allocation in addition to the
37- // / LinkGraph's own allocation and it notifies the debugger when necessary.
36+ // / Creates and manages DebugObjects for JITLink artifacts.
37+ // /
38+ // / DebugObjects are created when linking for a MaterializationResponsibility
39+ // / starts. They are pending as long as materialization is in progress.
40+ // /
41+ // / There can only be one pending DebugObject per MaterializationResponsibility.
42+ // / If materialization fails, pending DebugObjects are discarded.
43+ // /
44+ // / Once executable code for the MaterializationResponsibility is emitted, the
45+ // / corresponding DebugObject is finalized to target memory and the provided
46+ // / DebugObjectRegistrar is notified. Ownership of DebugObjects remains with the
47+ // / plugin.
3848// /
3949class LLVM_ABI ELFDebugObjectPlugin : public ObjectLinkingLayer::Plugin {
4050public:
41- // / Create the plugin for the given session and set additional options
51+ // / Create the plugin to submit DebugObjects for JITLink artifacts. For all
52+ // / options the recommended setting is true.
4253 // /
4354 // / RequireDebugSections:
44- // / Emit debug objects only if the LinkGraph contains debug info. Turning
45- // / this off allows minimal debugging based on raw symbol names, but it
46- // / comes with significant overhead for release configurations.
55+ // / Submit debug objects to the executor only if they contain actual debug
56+ // / info. Turning this off may allow minimal debugging based on raw symbol
57+ // / names. Note that this may cause significant memory and transport
58+ // / overhead for objects built with a release configuration.
4759 // /
4860 // / AutoRegisterCode:
4961 // / Notify the debugger for each new debug object. This is a good default
5062 // / mode, but it may cause significant overhead when adding many modules in
51- // / sequence. Otherwise the user must call __jit_debug_register_code() in
52- // / the debug session manually.
63+ // / sequence. When turning this off, the user has to issue the call to
64+ // / __jit_debug_register_code() on the executor side manually.
5365 // /
5466 ELFDebugObjectPlugin (ExecutionSession &ES, bool RequireDebugSections,
5567 bool AutoRegisterCode, Error &Err);
5668 ~ELFDebugObjectPlugin () override ;
5769
5870 void notifyMaterializing (MaterializationResponsibility &MR,
5971 jitlink::LinkGraph &G, jitlink::JITLinkContext &Ctx,
60- MemoryBufferRef InputObj ) override ;
72+ MemoryBufferRef InputObject ) override ;
6173
6274 Error notifyFailed (MaterializationResponsibility &MR) override ;
6375 Error notifyRemovingResources (JITDylib &JD, ResourceKey K) override ;
@@ -82,8 +94,6 @@ class LLVM_ABI ELFDebugObjectPlugin : public ObjectLinkingLayer::Plugin {
8294 ExecutorAddr RegistrationAction;
8395 bool RequireDebugSections;
8496 bool AutoRegisterCode;
85-
86- DebugObject *getPendingDebugObj (MaterializationResponsibility &MR);
8797};
8898
8999} // namespace orc
0 commit comments