|
12 | 12 | #include <llvm/Analysis/TargetTransformInfo.h> |
13 | 13 | #include <llvm/ExecutionEngine/Orc/CompileUtils.h> |
14 | 14 | #include <llvm/ExecutionEngine/Orc/ExecutionUtils.h> |
| 15 | +#include <llvm/ExecutionEngine/Orc/DebugObjectManagerPlugin.h> |
| 16 | +#include <llvm/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.h> |
15 | 17 | #include <llvm/ExecutionEngine/Orc/ExecutorProcessControl.h> |
16 | 18 | #include <llvm/IR/Verifier.h> |
17 | 19 | #include <llvm/Support/DynamicLibrary.h> |
@@ -1536,13 +1538,15 @@ llvm_orc_registerJITLoaderGDBAllocAction(const char *Data, size_t Size); |
1536 | 1538 |
|
1537 | 1539 | void JuliaOJIT::enableJITDebuggingSupport() |
1538 | 1540 | { |
1539 | | - // We do not use GDBJITDebugInfoRegistrationPlugin::Create, as the runtime name |
1540 | | - // lookup is unnecessarily involved/fragile for our in-process JIT use case |
1541 | | - // (with the llvm_orc_registerJITLoaderGDBAllocAction symbol being in either |
1542 | | - // libjulia-codegen or yet another shared library for LLVM depending on the build |
1543 | | - // flags, etc.). |
1544 | | - const auto Addr = ExecutorAddr::fromPtr(&llvm_orc_registerJITLoaderGDBAllocAction); |
1545 | | - ObjectLayer.addPlugin(std::make_unique<orc::GDBJITDebugInfoRegistrationPlugin>(Addr)); |
| 1541 | + orc::SymbolMap GDBFunctions; |
| 1542 | + GDBFunctions[mangle("llvm_orc_registerJITLoaderGDBAllocAction")] = JITEvaluatedSymbol::fromPointer(&llvm_orc_registerJITLoaderGDBAllocAction, JITSymbolFlags::Exported | JITSymbolFlags::Callable); |
| 1543 | + GDBFunctions[mangle("llvm_orc_registerJITLoaderGDBWrapper")] = JITEvaluatedSymbol::fromPointer(&llvm_orc_registerJITLoaderGDBWrapper, JITSymbolFlags::Exported | JITSymbolFlags::Callable); |
| 1544 | + cantFail(JD.define(orc::absoluteSymbols(GDBFunctions))); |
| 1545 | + if (TM->getTargetTriple().isOSBinFormatMachO()) |
| 1546 | + ObjectLayer.addPlugin(cantFail(orc::GDBJITDebugInfoRegistrationPlugin::Create(ES, JD, TM->getTargetTriple()))); |
| 1547 | + else if (TM->getTargetTriple().isOSBinFormatELF()) |
| 1548 | + //EPCDebugObjectRegistrar doesn't take a JITDylib, so we have to directly provide the call address |
| 1549 | + ObjectLayer.addPlugin(std::make_unique<orc::DebugObjectManagerPlugin>(ES, std::make_unique<orc::EPCDebugObjectRegistrar>(ES, orc::ExecutorAddr::fromPtr(&llvm_orc_registerJITLoaderGDBWrapper)))); |
1546 | 1550 | } |
1547 | 1551 | #else |
1548 | 1552 | void JuliaOJIT::enableJITDebuggingSupport() |
|
0 commit comments