From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- .../ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp') diff --git a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp index c591acdd646b..30d641ee00cf 100644 --- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp +++ b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp @@ -16,12 +16,17 @@ namespace llvm { namespace orc { -Expected> -createJITLoaderGDBRegistrar(ExecutionSession &ES) { +Expected> createJITLoaderGDBRegistrar( + ExecutionSession &ES, + std::optional RegistrationFunctionDylib) { auto &EPC = ES.getExecutorProcessControl(); - auto ProcessHandle = EPC.loadDylib(nullptr); - if (!ProcessHandle) - return ProcessHandle.takeError(); + + if (!RegistrationFunctionDylib) { + if (auto D = EPC.loadDylib(nullptr)) + RegistrationFunctionDylib = *D; + else + return D.takeError(); + } SymbolStringPtr RegisterFn = EPC.getTargetTriple().isOSBinFormatMachO() @@ -31,7 +36,8 @@ createJITLoaderGDBRegistrar(ExecutionSession &ES) { SymbolLookupSet RegistrationSymbols; RegistrationSymbols.add(RegisterFn); - auto Result = EPC.lookupSymbols({{*ProcessHandle, RegistrationSymbols}}); + auto Result = + EPC.lookupSymbols({{*RegistrationFunctionDylib, RegistrationSymbols}}); if (!Result) return Result.takeError(); -- cgit v1.2.3