setting RLIMIT to INFINITY.

This is to generate coredumps for processes spawned by zygote

Change-Id: I799ffe9165e86ad749a8d4adc9fbddaf1ce893de
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 9da44a4..2b3d10c 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -34,7 +34,9 @@
 #if defined(__linux__)
 #include <sys/prctl.h>
 #endif
-
+#ifdef __ANDROID__
+#include <cutils/properties.h>
+#endif
 #include <sys/resource.h>
 
 namespace art {
@@ -59,7 +61,18 @@
 #endif
   // We don't want core dumps, though, so set the core dump size to 0.
   rlimit rl;
+#ifdef __ANDROID__
+  char prop_value[PROPERTY_VALUE_MAX];
+  property_get("persist.debug.trace", prop_value, "0");
+  if (prop_value[0] == '1') {
+      LOG(INFO) << "setting RLIM to infinity for process " << getpid();
+      rl.rlim_cur = RLIM_INFINITY;
+  } else {
+      rl.rlim_cur = 0;
+  }
+#else
   rl.rlim_cur = 0;
+#endif
   rl.rlim_max = RLIM_INFINITY;
   if (setrlimit(RLIMIT_CORE, &rl) == -1) {
     PLOG(ERROR) << "setrlimit(RLIMIT_CORE) failed for pid " << getpid();