1 //===- EPCDebugObjectRegistrar.h - EPC-based debug registration -*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // 9 // ExecutorProcessControl based registration of debug objects. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H 14 #define LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H 15 16 #include "llvm/ExecutionEngine/JITSymbol.h" 17 #include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" 18 #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h" 19 #include "llvm/Support/Error.h" 20 #include "llvm/Support/Memory.h" 21 22 #include <cstdint> 23 #include <memory> 24 #include <vector> 25 26 using namespace llvm::orc::shared; 27 28 namespace llvm { 29 namespace orc { 30 31 class ExecutionSession; 32 33 /// Abstract interface for registering debug objects in the executor process. 34 class DebugObjectRegistrar { 35 public: 36 virtual Error registerDebugObject(ExecutorAddrRange TargetMem) = 0; 37 virtual ~DebugObjectRegistrar() = default; 38 }; 39 40 /// Use ExecutorProcessControl to register debug objects locally or in a remote 41 /// executor process. 42 class EPCDebugObjectRegistrar : public DebugObjectRegistrar { 43 public: 44 EPCDebugObjectRegistrar(ExecutionSession &ES, ExecutorAddr RegisterFn) 45 : ES(ES), RegisterFn(RegisterFn) {} 46 47 Error registerDebugObject(ExecutorAddrRange TargetMem) override; 48 49 private: 50 ExecutionSession &ES; 51 ExecutorAddr RegisterFn; 52 }; 53 54 /// Create a ExecutorProcessControl-based DebugObjectRegistrar that emits debug 55 /// objects to the GDB JIT interface. 56 Expected<std::unique_ptr<EPCDebugObjectRegistrar>> 57 createJITLoaderGDBRegistrar(ExecutionSession &ES); 58 59 } // end namespace orc 60 } // end namespace llvm 61 62 #endif // LLVM_EXECUTIONENGINE_ORC_EPCDEBUGOBJECTREGISTRAR_H 63