aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp
diff options
context:
space:
mode:
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();