diff options
author | Lang Hames <lhames@gmail.com> | 2014-11-26 07:39:03 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2014-11-26 07:39:03 +0000 |
commit | 7cacb9b54057f7a368ed9788799c06264baddb20 (patch) | |
tree | 8047b32cd51271d747ad867673136cf4b1b13be1 | |
parent | 08a01ae3728e8896129cc6057ca2895d4e70b8e6 (diff) | |
download | bcm5719-llvm-7cacb9b54057f7a368ed9788799c06264baddb20.tar.gz bcm5719-llvm-7cacb9b54057f7a368ed9788799c06264baddb20.zip |
[MCJIT] Re-enable GDB registration (temporarily disabled in r222811), but check
that we actually have an object to register first.
For MachO objects, RuntimeDyld::LoadedObjectInfo::getObjectForDebug returns an
empty OwningBinary<ObjectFile> which was causing crashes in the GDB registration
code.
llvm-svn: 222812
-rw-r--r-- | llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp | 1 | ||||
-rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp index 490fbb3df99..58cf4e5e6dd 100644 --- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp +++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp @@ -75,6 +75,7 @@ MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> tm, OwnedModules.addModule(std::move(First)); setDataLayout(TM->getSubtargetImpl()->getDataLayout()); + RegisterJITEventListener(JITEventListener::createGDBRegistrationListener()); } MCJIT::~MCJIT() { diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp index 641d3a26270..13d5672a82b 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp @@ -151,6 +151,11 @@ void GDBJITRegistrationListener::NotifyObjectEmitted( const RuntimeDyld::LoadedObjectInfo &L) { OwningBinary<ObjectFile> DebugObj = L.getObjectForDebug(Object); + + // Bail out if debug objects aren't supported. + if (!DebugObj.getBinary()) + return; + const char *Buffer = DebugObj.getBinary()->getMemoryBufferRef().getBufferStart(); size_t Size = DebugObj.getBinary()->getMemoryBufferRef().getBufferSize(); |