resolved conflicts for merge of 7c75d915 to master

Change-Id: I25c1dc90af679e2463abffd33ee8838b4727396f
diff --git a/lib/ExecutionEngine/Script.cpp b/lib/ExecutionEngine/Script.cpp
index ddd9933..14d38bf 100644
--- a/lib/ExecutionEngine/Script.cpp
+++ b/lib/ExecutionEngine/Script.cpp
@@ -33,6 +33,7 @@
 
 #include "DebugHelper.h"
 #include "FileHandle.h"
+#include "GDBJITRegistrar.h"
 #include "ScriptCompiled.h"
 #include "ScriptCached.h"
 #include "Sha1Helper.h"
@@ -47,7 +48,6 @@
 #include <string.h>
 #include <cutils/properties.h>
 
-
 namespace {
 
 bool getBooleanProp(const char *str) {
@@ -221,22 +221,30 @@
     return 1;
   }
 
+  int status = -1;
 #if USE_CACHE
   if (internalLoadCache(cacheDir, cacheName,
                         ScriptObject::Executable, /* checkOnly */ false) == 0) {
-    return 0;
+    status = 0;
   }
 #endif
 
-  CompilerOption option;
-  int status = internalCompile(option);
+  if (status != 0) {
+    CompilerOption option;
+    status = internalCompile(option);
+  }
+
   if (status != 0) {
     ALOGE("LLVM error message: %s\n", getCompilerErrorMessage());
   }
+
+  // FIXME: Registration can be conditional on the presence of debug metadata
+  if (status == 0) {
+    registerObjectWithGDB(getELF(), getELFSize()); // thread-safe registration
+  }
   return status;
 }
 
-
 #if USE_CACHE
 int Script::internalLoadCache(char const *cacheDir, char const *cacheName,
                               ScriptObject::ObjectType objectType,
@@ -832,7 +840,11 @@
     case ScriptStatus::Compiled: {
       return mCompiled->getELFSize();
     }
-
+#if USE_CACHE
+    case ScriptStatus::Cached: {
+      return mCached->getELFSize();
+    }
+#endif
     default: {
       return 0;
     }
@@ -844,7 +856,11 @@
     case ScriptStatus::Compiled: {
       return mCompiled->getELF();
     }
-
+#if USE_CACHE
+    case ScriptStatus::Cached: {
+      return mCached->getELF();
+    }
+#endif
     default: {
       return NULL;
     }