|
18 | 18 |
|
19 | 19 | #include "llvm/Bitcode/BitcodeReader.h"
|
20 | 20 | #include "llvm/Bitcode/BitcodeWriter.h"
|
| 21 | +#include "llvm/ExecutionEngine/JITEventListener.h" |
21 | 22 | #include "llvm/ExecutionEngine/ObjectCache.h"
|
22 | 23 | #include "llvm/ExecutionEngine/Orc/CompileUtils.h"
|
23 | 24 | #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
|
@@ -182,7 +183,8 @@ static void packFunctionArguments(Module *module) {
|
182 | 183 | }
|
183 | 184 |
|
184 | 185 | ExecutionEngine::ExecutionEngine(bool enableObjectCache)
|
185 |
| - : cache(enableObjectCache ? nullptr : new SimpleObjectCache()) {} |
| 186 | + : cache(enableObjectCache ? nullptr : new SimpleObjectCache()), |
| 187 | + gdbListener(llvm::JITEventListener::createGDBRegistrationListener()) {} |
186 | 188 |
|
187 | 189 | Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
|
188 | 190 | ModuleOp m, std::function<Error(llvm::Module *)> transformer,
|
@@ -221,6 +223,14 @@ Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
|
221 | 223 | const Triple &TT) {
|
222 | 224 | auto objectLayer = std::make_unique<RTDyldObjectLinkingLayer>(
|
223 | 225 | session, []() { return std::make_unique<SectionMemoryManager>(); });
|
| 226 | + objectLayer->setNotifyLoaded( |
| 227 | + [engine = engine.get()]( |
| 228 | + llvm::orc::VModuleKey, const llvm::object::ObjectFile &object, |
| 229 | + const llvm::RuntimeDyld::LoadedObjectInfo &objectInfo) { |
| 230 | + uint64_t key = static_cast<uint64_t>( |
| 231 | + reinterpret_cast<uintptr_t>(object.getData().data())); |
| 232 | + engine->gdbListener->notifyObjectLoaded(key, object, objectInfo); |
| 233 | + }); |
224 | 234 | auto dataLayout = deserModule->getDataLayout();
|
225 | 235 | llvm::orc::JITDylib *mainJD = session.getJITDylibByName("<main>");
|
226 | 236 | if (!mainJD)
|
|
0 commit comments