summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2013-03-27 03:09:55 +0000
committerSean Callanan <scallanan@apple.com>2013-03-27 03:09:55 +0000
commit44bc657efe77fde8b660b22af3c937baabbc79a2 (patch)
tree40dad2c234d3a3aa8971a2cfdb66a889ea2649e4
parenta1b72d0f6a6b3db28cbec2500112d1914bae9662 (diff)
downloadbcm5719-llvm-44bc657efe77fde8b660b22af3c937baabbc79a2.tar.gz
bcm5719-llvm-44bc657efe77fde8b660b22af3c937baabbc79a2.zip
Fixed a problem where inline assembly errors caused
LLDB to crash. <rdar://problem/13497915> llvm-svn: 178115
-rw-r--r--lldb/source/Expression/IRExecutionUnit.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index d8ddf9bf865..c3a2f8aacb7 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -11,7 +11,9 @@
// C++ Includes
// Other libraries and framework includes
#include "llvm/ExecutionEngine/ExecutionEngine.h"
+#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
+#include "llvm/Support/SourceMgr.h"
// Project includes
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
@@ -253,6 +255,17 @@ IRExecutionUnit::DisassembleFunction (Stream &stream,
return ret;
}
+static void ReportInlineAsmError(const llvm::SMDiagnostic &diagnostic, void *Context, unsigned LocCookie)
+{
+ Error *err = static_cast<Error*>(Context);
+
+ if (err && err->Success())
+ {
+ err->SetErrorToGenericError();
+ err->SetErrorStringWithFormat("Inline assembly error: %s", diagnostic.getMessage().str().c_str());
+ }
+}
+
void
IRExecutionUnit::GetRunnableInfo(Error &error,
lldb::addr_t &func_addr,
@@ -325,6 +338,8 @@ IRExecutionUnit::GetRunnableInfo(Error &error,
codeModel = llvm::CodeModel::Small;
}
+ m_module_ap->getContext().setInlineAsmDiagnosticHandler(ReportInlineAsmError, &error);
+
llvm::EngineBuilder builder(m_module_ap.get());
builder.setEngineKind(llvm::EngineKind::JIT)
@@ -367,7 +382,11 @@ IRExecutionUnit::GetRunnableInfo(Error &error,
void *fun_ptr = m_execution_engine_ap->getPointerToFunction(function);
- // Errors usually cause failures in the JIT, but if we're lucky we get here.
+ if (!error.Success())
+ {
+ // We got an error through our callback!
+ return;
+ }
if (!function)
{
OpenPOWER on IntegriCloud