Skip to content

Conversation

@weliveindetail
Copy link
Member

EPCDebugObjectRegistrar will be unused once the DebugObjectManagerPlugin uses AllocActions #167866

@weliveindetail weliveindetail force-pushed the orc-drop-debugobjectregistrar branch from 24b7d3e to 88ec9ce Compare November 17, 2025 10:31
@weliveindetail weliveindetail marked this pull request as ready for review November 17, 2025 10:50
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Nov 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 17, 2025

@llvm/pr-subscribers-clang

Author: Stefan Gränitz (weliveindetail)

Changes

EPCDebugObjectRegistrar will be unused once the DebugObjectManagerPlugin uses AllocActions #167866


Full diff: https://github.com/llvm/llvm-project/pull/167868.diff

13 Files Affected:

  • (modified) clang/lib/Interpreter/IncrementalExecutor.cpp (-1)
  • (modified) llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp (-1)
  • (modified) llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h (-1)
  • (removed) llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h (-69)
  • (modified) llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h (-3)
  • (modified) llvm/lib/ExecutionEngine/Orc/CMakeLists.txt (-1)
  • (removed) llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp (-61)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp (-16)
  • (modified) llvm/tools/lli/lli.cpp (-1)
  • (modified) llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp (-1)
  • (modified) llvm/tools/llvm-jitlink/llvm-jitlink.cpp (-2)
  • (modified) llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp (-1)
  • (modified) llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn (-1)
diff --git a/clang/lib/Interpreter/IncrementalExecutor.cpp b/clang/lib/Interpreter/IncrementalExecutor.cpp
index 45620fcd358c8..c2d6dadda662f 100644
--- a/clang/lib/Interpreter/IncrementalExecutor.cpp
+++ b/clang/lib/Interpreter/IncrementalExecutor.cpp
@@ -20,7 +20,6 @@
 #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
 #include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
 #include "llvm/ExecutionEngine/Orc/Debugging/DebuggerSupport.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
 #include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
 #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h"
diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
index 83c5899852d64..2f000445292a6 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/RemoteJITUtils.cpp
@@ -10,7 +10,6 @@
 
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
 #include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
 #include "llvm/ExecutionEngine/Orc/Shared/SimpleRemoteEPCUtils.h"
 #include "llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h"
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
index 3ca3afa122836..cdb168bd61d32 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Debugging/DebuggerSupportPlugin.h
@@ -14,7 +14,6 @@
 #define LLVM_EXECUTIONENGINE_ORC_DEBUGGERSUPPORTPLUGIN_H
 
 #include "llvm/ExecutionEngine/Orc/Core.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
 #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h"
 #include "llvm/Support/Compiler.h"
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
deleted file mode 100644
index 3a92eee0430c5..0000000000000
--- a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h
+++ /dev/null
@@ -1,69 +0,0 @@
-//===- EPCDebugObjectRegistrar.h - EPC-based debug registration -*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// ExecutorProcessControl based registration of debug objects.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
-#define LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
-
-#include "llvm/ExecutionEngine/JITSymbol.h"
-#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
-#include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/Memory.h"
-
-#include <cstdint>
-#include <memory>
-
-namespace llvm {
-namespace orc {
-
-class ExecutionSession;
-
-/// Abstract interface for registering debug objects in the executor process.
-class DebugObjectRegistrar {
-public:
-  virtual Error registerDebugObject(ExecutorAddrRange TargetMem,
-                                    bool AutoRegisterCode) = 0;
-  virtual ~DebugObjectRegistrar() = default;
-};
-
-/// Use ExecutorProcessControl to register debug objects locally or in a remote
-/// executor process.
-class LLVM_ABI EPCDebugObjectRegistrar : public DebugObjectRegistrar {
-public:
-  EPCDebugObjectRegistrar(ExecutionSession &ES, ExecutorAddr RegisterFn)
-      : ES(ES), RegisterFn(RegisterFn) {}
-
-  Error registerDebugObject(ExecutorAddrRange TargetMem,
-                            bool AutoRegisterCode) override;
-
-private:
-  ExecutionSession &ES;
-  ExecutorAddr RegisterFn;
-};
-
-/// Create a ExecutorProcessControl-based DebugObjectRegistrar that emits debug
-/// objects to the GDB JIT interface. This will use the EPC's lookupSymbols
-/// method to find the registration/deregistration  function addresses by name.
-///
-/// If RegistrationFunctionsDylib is non-None then it will be searched to find
-/// the registration functions. If it is None then the process dylib will be
-/// loaded to find the registration functions.
-LLVM_ABI Expected<std::unique_ptr<EPCDebugObjectRegistrar>>
-createJITLoaderGDBRegistrar(
-    ExecutionSession &ES,
-    std::optional<ExecutorAddr> RegistrationFunctionDylib = std::nullopt);
-
-} // end namespace orc
-} // end namespace llvm
-
-#endif // LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
index 5a9517b1ce7cc..bc3c6fa332a2d 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h
@@ -43,9 +43,6 @@ struct jit_descriptor {
 };
 }
 
-extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
-llvm_orc_registerJITLoaderGDBWrapper(const char *ArgData, size_t ArgSize);
-
 extern "C" LLVM_ABI llvm::orc::shared::CWrapperFunctionResult
 llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize);
 
diff --git a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
index f34392538a7cb..b71f0627fcb27 100644
--- a/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/Orc/CMakeLists.txt
@@ -18,7 +18,6 @@ add_llvm_component_library(LLVMOrcJIT
   DebugUtils.cpp
   EHFrameRegistrationPlugin.cpp
   EPCDynamicLibrarySearchGenerator.cpp
-  EPCDebugObjectRegistrar.cpp
   EPCGenericDylibManager.cpp
   EPCGenericJITLinkMemoryManager.cpp
   EPCGenericRTDyldMemoryManager.cpp
diff --git a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
deleted file mode 100644
index 08bef37b06c82..0000000000000
--- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//===----- EPCDebugObjectRegistrar.cpp - EPC-based debug registration -----===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
-
-#include "llvm/ExecutionEngine/Orc/Core.h"
-
-namespace llvm {
-namespace orc {
-
-Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
-    ExecutionSession &ES,
-    std::optional<ExecutorAddr> RegistrationFunctionDylib) {
-  auto &EPC = ES.getExecutorProcessControl();
-
-  if (!RegistrationFunctionDylib) {
-    if (auto D = EPC.getDylibMgr().loadDylib(nullptr))
-      RegistrationFunctionDylib = *D;
-    else
-      return D.takeError();
-  }
-
-  SymbolStringPtr RegisterFn =
-      EPC.getTargetTriple().isOSBinFormatMachO()
-          ? EPC.intern("_llvm_orc_registerJITLoaderGDBWrapper")
-          : EPC.intern("llvm_orc_registerJITLoaderGDBWrapper");
-
-  SymbolLookupSet RegistrationSymbols;
-  RegistrationSymbols.add(RegisterFn);
-
-  auto Result = EPC.getDylibMgr().lookupSymbols(
-      {{*RegistrationFunctionDylib, RegistrationSymbols}});
-  if (!Result)
-    return Result.takeError();
-
-  assert(Result->size() == 1 && "Unexpected number of dylibs in result");
-  assert((*Result)[0].size() == 1 &&
-         "Unexpected number of addresses in result");
-
-  if (!(*Result)[0][0].has_value())
-    return make_error<StringError>(
-        "Expected a valid address in the lookup result",
-        inconvertibleErrorCode());
-
-  ExecutorAddr RegisterAddr = (*Result)[0][0]->getAddress();
-  return std::make_unique<EPCDebugObjectRegistrar>(ES, RegisterAddr);
-}
-
-Error EPCDebugObjectRegistrar::registerDebugObject(ExecutorAddrRange TargetMem,
-                                                   bool AutoRegisterCode) {
-  return ES.callSPSWrapper<void(shared::SPSExecutorAddrRange, bool)>(
-      RegisterFn, TargetMem, AutoRegisterCode);
-}
-
-} // namespace orc
-} // namespace llvm
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index cb1b3b05cd24d..f255de093b24f 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -88,19 +88,3 @@ llvm_orc_registerJITLoaderGDBAllocAction(const char *ArgData, size_t ArgSize) {
              })
       .release();
 }
-
-extern "C" orc::shared::CWrapperFunctionResult
-llvm_orc_registerJITLoaderGDBWrapper(const char *ArgData, size_t ArgSize) {
-  using namespace orc::shared;
-  return WrapperFunction<SPSError(SPSExecutorAddrRange, bool)>::handle(
-             ArgData, ArgSize,
-             [](ExecutorAddrRange R, bool AutoRegisterCode) {
-               appendJITDebugDescriptor(R.Start.toPtr<const char *>(),
-                                        R.size());
-               // Run into the rendezvous breakpoint.
-               if (AutoRegisterCode)
-                 __jit_debug_register_code();
-               return Error::success();
-             })
-      .release();
-}
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index f1cf87fc88cee..847ee3263c02f 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -283,7 +283,6 @@ static ExitOnError ExitOnErr;
 LLVM_ATTRIBUTE_USED static void linkComponents() {
   errs() << (void *)&llvm_orc_registerEHFrameSectionAllocAction
          << (void *)&llvm_orc_deregisterEHFrameSectionAllocAction
-         << (void *)&llvm_orc_registerJITLoaderGDBWrapper
          << (void *)&llvm_orc_registerJITLoaderGDBAllocAction;
 }
 
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
index 8d33ae1edcaaa..2cffca27623e9 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp
@@ -44,7 +44,6 @@ ExitOnError ExitOnErr;
 LLVM_ATTRIBUTE_USED void linkComponents() {
   errs() << (void *)&llvm_orc_registerEHFrameSectionAllocAction
          << (void *)&llvm_orc_deregisterEHFrameSectionAllocAction
-         << (void *)&llvm_orc_registerJITLoaderGDBWrapper
          << (void *)&llvm_orc_registerJITLoaderGDBAllocAction;
 }
 
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 50b4ac372b4e4..8610fd042705e 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -24,7 +24,6 @@
 #include "llvm/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.h"
 #include "llvm/ExecutionEngine/Orc/EHFrameRegistrationPlugin.h"
 #include "llvm/ExecutionEngine/Orc/ELFNixPlatform.h"
-#include "llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h"
 #include "llvm/ExecutionEngine/Orc/EPCDynamicLibrarySearchGenerator.h"
 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
 #include "llvm/ExecutionEngine/Orc/GetDylibInterface.h"
@@ -348,7 +347,6 @@ static LLVM_ATTRIBUTE_USED void linkComponents() {
   errs() << "Linking in runtime functions\n"
          << (void *)&llvm_orc_registerEHFrameSectionAllocAction << '\n'
          << (void *)&llvm_orc_deregisterEHFrameSectionAllocAction << '\n'
-         << (void *)&llvm_orc_registerJITLoaderGDBWrapper << '\n'
          << (void *)&llvm_orc_registerJITLoaderGDBAllocAction << '\n'
          << (void *)&llvm_orc_registerJITLoaderPerfStart << '\n'
          << (void *)&llvm_orc_registerJITLoaderPerfEnd << '\n'
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index d3fcb948fafb8..0ddbb33c4bac5 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -547,7 +547,6 @@ TEST_F(OrcCAPITestBase, DISABLED_EnableDebugSupport) {
 #else
 static LLVM_ATTRIBUTE_USED void linkComponents() {
   errs() << "Linking in runtime functions\n"
-         << (void *)&llvm_orc_registerJITLoaderGDBWrapper << '\n'
          << (void *)&llvm_orc_registerJITLoaderGDBAllocAction << '\n';
 }
 TEST_F(OrcCAPITestBase, EnableDebugSupport) {
diff --git a/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn b/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
index 84384217897c4..f7d635fe4eb90 100644
--- a/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/ExecutionEngine/Orc/BUILD.gn
@@ -26,7 +26,6 @@ static_library("Orc") {
     "DebugUtils.cpp",
     "EHFrameRegistrationPlugin.cpp",
     "ELFNixPlatform.cpp",
-    "EPCDebugObjectRegistrar.cpp",
     "EPCDynamicLibrarySearchGenerator.cpp",
     "EPCGenericDylibManager.cpp",
     "EPCGenericJITLinkMemoryManager.cpp",

@llvmbot llvmbot added the bazel "Peripheral" support tier build system: utils/bazel label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel "Peripheral" support tier build system: utils/bazel clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category orcjit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants