[llvm] r222812 - [MCJIT] Re-enable GDB registration (temporarily disabled in r222811), but check
Lang Hames
lhames at gmail.com
Tue Nov 25 23:39:03 PST 2014
Author: lhames
Date: Wed Nov 26 01:39:03 2014
New Revision: 222812
URL: http://llvm.org/viewvc/llvm-project?rev=222812&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp
Modified: llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp?rev=222812&r1=222811&r2=222812&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/MCJIT/MCJIT.cpp Wed Nov 26 01:39:03 2014
@@ -75,6 +75,7 @@ MCJIT::MCJIT(std::unique_ptr<Module> M,
OwnedModules.addModule(std::move(First));
setDataLayout(TM->getSubtargetImpl()->getDataLayout());
+ RegisterJITEventListener(JITEventListener::createGDBRegistrationListener());
}
MCJIT::~MCJIT() {
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp?rev=222812&r1=222811&r2=222812&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/GDBRegistrationListener.cpp Wed Nov 26 01:39:03 2014
@@ -151,6 +151,11 @@ void GDBJITRegistrationListener::NotifyO
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();
More information about the llvm-commits
mailing list