[lldb] Quick Fix: IRExecutionUnit check pointer before access it
authorAlex Langford <apl@fb.com>
Tue, 9 Jul 2019 22:24:54 +0000 (22:24 +0000)
committerAlex Langford <apl@fb.com>
Tue, 9 Jul 2019 22:24:54 +0000 (22:24 +0000)
Summary:
Move checking pointer code block before accessing the pointer
This caused lldb to crash when testing on Android

Patch by Wanyi Ye!

Differential Revision: https://reviews.llvm.org/D64434

llvm-svn: 365567

lldb/source/Expression/IRExecutionUnit.cpp

index 00e12f3..25404ad 100644 (file)
@@ -285,9 +285,6 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
 
   m_execution_engine_up.reset(builder.create(target_machine));
 
-  m_strip_underscore =
-      (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
     error.SetErrorToGenericError();
     error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@ void IRExecutionUnit::GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
     return;
   }
 
+  m_strip_underscore =
+      (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
     void notifyObjectCompiled(const llvm::Module *module,