aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2023-02-11 12:38:11 +0000
commite3b557809604d036af6e00c60f012c2025b59a5e (patch)
tree8a11ba2269a3b669601e2fd41145b174008f4da8 /llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
parent08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff)
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp18
1 files changed, 12 insertions, 6 deletions
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<std::unique_ptr<EPCDebugObjectRegistrar>>
-createJITLoaderGDBRegistrar(ExecutionSession &ES) {
+Expected<std::unique_ptr<EPCDebugObjectRegistrar>> createJITLoaderGDBRegistrar(
+ ExecutionSession &ES,
+ std::optional<ExecutorAddr> 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();