Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:52

0001 //===- EPCDebugObjectRegistrar.h - EPC-based debug registration -*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // ExecutorProcessControl based registration of debug objects.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
0014 #define LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H
0015 
0016 #include "llvm/ExecutionEngine/JITSymbol.h"
0017 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
0018 #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
0019 #include "llvm/Support/Error.h"
0020 #include "llvm/Support/Memory.h"
0021 
0022 #include <cstdint>
0023 #include <memory>
0024 
0025 namespace llvm {
0026 namespace orc {
0027 
0028 class ExecutionSession;
0029 
0030 /// Abstract interface for registering debug objects in the executor process.
0031 class DebugObjectRegistrar {
0032 public:
0033   virtual Error registerDebugObject(ExecutorAddrRange TargetMem,
0034                                     bool AutoRegisterCode) = 0;
0035   virtual ~DebugObjectRegistrar() = default;
0036 };
0037 
0038 /// Use ExecutorProcessControl to register debug objects locally or in a remote
0039 /// executor process.
0040 class EPCDebugObjectRegistrar : public DebugObjectRegistrar {
0041 public:
0042   EPCDebugObjectRegistrar(ExecutionSession &ES, ExecutorAddr RegisterFn)
0043       : ES(ES), RegisterFn(RegisterFn) {}
0044 
0045   Error registerDebugObject(ExecutorAddrRange TargetMem,
0046                             bool AutoRegisterCode) override;
0047 
0048 private:
0049   ExecutionSession &ES;
0050   ExecutorAddr RegisterFn;
0051 };
0052 
0053 /// Create a ExecutorProcessControl-based DebugObjectRegistrar that emits debug
0054 /// objects to the GDB JIT interface. This will use the EPC's lookupSymbols
0055 /// method to find the registration/deregistration  function addresses by name.
0056 ///
0057 /// If RegistrationFunctionsDylib is non-None then it will be searched to find
0058 /// the registration functions. If it is None then the process dylib will be
0059 /// loaded to find the registration functions.
0060 Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
0061     ExecutionSession &ES,
0062     std::optional<ExecutorAddr> RegistrationFunctionDylib = std::nullopt);
0063 
0064 } // end namespace orc
0065 } // end namespace llvm
0066 
0067 #endif // LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H