[llvm] 6a2afb0 - [ORC] Drop AutoRegisterCode option for JIT-debug registration (#215721)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 23:27:43 PDT 2026


Author: Lang Hames
Date: 2026-08-12T16:27:38+10:00
New Revision: 6a2afb09ea149be327311977bfe64f3875860a4a

URL: https://github.com/llvm/llvm-project/commit/6a2afb09ea149be327311977bfe64f3875860a4a
DIFF: https://github.com/llvm/llvm-project/commit/6a2afb09ea149be327311977bfe64f3875860a4a.diff

LOG: [ORC] Drop AutoRegisterCode option for JIT-debug registration (#215721)

AutoRegisterCode was introduced in 4c7f53b99c0 to gate calls to the
debugger rendezvous breakpoint `__jit_debug_register_code()`. The
assumption was that this would facilitate batched registration of JIT'd
debug info: clients could call `__jit_debug_register_code()` manually
after multiple object files worth of debug info were accumulated. This
assumption turns out not to be true: Debuggers only consume the most
recently recorded object file when the rendezvous breakpoint is
triggered, and all previously recorded, as-yet-unregistered, debug info
is ignored.

Since calling the rendezvous function is essential for correctness when
a debugger is attached, and essentially free when a debugger is not
attached, we should just call it unconditionally.

Added: 
    

Modified: 
    llvm/include/llvm/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.h
    llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
    llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
    llvm/lib/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.cpp
    llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
    llvm/tools/llvm-jitlink/llvm-jitlink.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.h
index 92dbfe1c79e6e..98d5302c13c07 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.h
@@ -45,14 +45,8 @@ class LLVM_ABI ELFDebugObjectPlugin : public ObjectLinkingLayer::Plugin {
   ///   this off allows minimal debugging based on raw symbol names, but it
   ///   comes with significant overhead for release configurations.
   ///
-  /// AutoRegisterCode:
-  ///   Notify the debugger for each new debug object. This is a good default
-  ///   mode, but it may cause significant overhead when adding many modules in
-  ///   sequence. Otherwise the user must call __jit_debug_register_code() in
-  ///   the debug session manually.
-  ///
   ELFDebugObjectPlugin(ExecutionSession &ES, bool RequireDebugSections,
-                       bool AutoRegisterCode, Error &Err);
+                       Error &Err);
   ~ELFDebugObjectPlugin() override;
 
   void notifyMaterializing(MaterializationResponsibility &MR,
@@ -81,7 +75,6 @@ class LLVM_ABI ELFDebugObjectPlugin : public ObjectLinkingLayer::Plugin {
 
   ExecutorAddr RegistrationAction;
   bool RequireDebugSections;
-  bool AutoRegisterCode;
 
   DebugObject *getPendingDebugObj(MaterializationResponsibility &MR);
 };

diff  --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
index 7be58871ff57b..caee699feebc1 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupport.cpp
@@ -37,7 +37,7 @@ Error enableDebuggerSupport(LLJIT &J) {
   case Triple::ELF: {
     Error TargetSymErr = Error::success();
     ObjLinkingLayer->addPlugin(
-        std::make_unique<ELFDebugObjectPlugin>(ES, false, true, TargetSymErr));
+        std::make_unique<ELFDebugObjectPlugin>(ES, false, TargetSymErr));
     return TargetSymErr;
   }
   case Triple::MachO: {

diff  --git a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
index 4ceff483ad799..22be7e6ca17dd 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.cpp
@@ -283,12 +283,11 @@ class MachODebugObjectSynthesizer : public MachODebugObjectSynthesizerBase {
 
     Builder.write(MachOContainerBlock->getAlreadyMutableContent());
 
-    static constexpr bool AutoRegisterCode = true;
     SectionRange R(MachOContainerBlock->getSection());
     G.allocActions().push_back(
         {cantFail(shared::WrapperFunctionCall::Create<
-                  shared::SPSArgList<shared::SPSExecutorAddrRange, bool>>(
-             RegisterActionAddr, R.getRange(), AutoRegisterCode)),
+                  shared::SPSArgList<shared::SPSExecutorAddrRange>>(
+             RegisterActionAddr, R.getRange())),
          {}});
 
     return Error::success();

diff  --git a/llvm/lib/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.cpp b/llvm/lib/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.cpp
index 10e9dfdfea79f..b284c0d4b857d 100644
--- a/llvm/lib/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/Debugging/ELFDebugObjectPlugin.cpp
@@ -193,9 +193,8 @@ Error DebugObject::visitSections(GetLoadAddressFn Callback) {
 
 ELFDebugObjectPlugin::ELFDebugObjectPlugin(ExecutionSession &ES,
                                            bool RequireDebugSections,
-                                           bool AutoRegisterCode, Error &Err)
-    : ES(ES), RequireDebugSections(RequireDebugSections),
-      AutoRegisterCode(AutoRegisterCode) {
+                                           Error &Err)
+    : ES(ES), RequireDebugSections(RequireDebugSections) {
   // Pass bootstrap symbol for registration function to enable debugging
   ErrorAsOutParameter _(&Err);
   Err = ES.getExecutorProcessControl().getBootstrapSymbols(
@@ -377,9 +376,8 @@ void ELFDebugObjectPlugin::modifyPassConfig(MaterializationResponsibility &MR,
 
     using namespace shared;
     G.allocActions().push_back(
-        {cantFail(WrapperFunctionCall::Create<
-                  SPSArgList<SPSExecutorAddrRange, bool>>(
-             RegistrationAction, *R, AutoRegisterCode)),
+        {cantFail(WrapperFunctionCall::Create<SPSArgList<SPSExecutorAddrRange>>(
+             RegistrationAction, *R)),
          {/* no deregistration */}});
     return Error::success();
   });

diff  --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index a2f9a898a2dfe..4a64cfc0056af 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -75,14 +75,13 @@ static void appendJITDebugDescriptor(const char *ObjAddr, size_t Size) {
 extern "C" orc::shared::CWrapperFunctionBuffer
 llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize) {
   using namespace orc::shared;
-  return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
+  return WrapperFunction<SPSError(SPSExecutorAddrRange)>::handle(
              ArgData, ArgSize,
-             [](ExecutorAddrRange R, bool AutoRegisterCode) {
+             [](ExecutorAddrRange R) {
                appendJITDebugDescriptor(R.Start.toPtr<const char *>(),
                                         R.size());
                // Run into the rendezvous breakpoint.
-               if (AutoRegisterCode)
-                 __jit_debug_register_code();
+               __jit_debug_register_code();
                return Error::success();
              })
       .release();

diff  --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index d62c70ed4b48f..17e63ff7aed47 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -1371,7 +1371,7 @@ Session::Session(std::unique_ptr<ExecutorProcessControl> EPC, Error &Err)
     if (DebuggerSupport) {
       Error TargetSymErr = Error::success();
       auto Plugin =
-          std::make_unique<ELFDebugObjectPlugin>(ES, true, true, TargetSymErr);
+          std::make_unique<ELFDebugObjectPlugin>(ES, true, TargetSymErr);
       if (!TargetSymErr)
         ObjLayer->addPlugin(std::move(Plugin));
       else


        


More information about the llvm-commits mailing list