diff options
author | Maunik Shah <mshah@codeaurora.org> | 2014-09-04 01:37:44 +0530 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2016-06-05 02:26:16 -0700 |
commit | a85d319d9aa74ae12f80a896c15489c5575e76c0 (patch) | |
tree | c0d37237dfa51b0ade8607274cd636de2570594d | |
parent | 9179ac85152dcf4a8acfdf181e33226ad6efa92d (diff) | |
download | android_art-a85d319d9aa74ae12f80a896c15489c5575e76c0.tar.gz android_art-a85d319d9aa74ae12f80a896c15489c5575e76c0.tar.bz2 android_art-a85d319d9aa74ae12f80a896c15489c5575e76c0.zip |
setting RLIMIT to INFINITY.
This is to generate coredumps for processes spawned by zygote
Change-Id: Iecc1eb7784373ffaf3ebfdc60d32d2ae0beb3235
-rw-r--r-- | runtime/native/dalvik_system_ZygoteHooks.cc | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc index 1d067063a4..ac07845eae 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 HAVE_ANDROID_OS +#include <cutils/properties.h> +#endif #include <sys/resource.h> namespace art { @@ -49,7 +51,18 @@ static void EnableDebugger() { #endif // We don't want core dumps, though, so set the core dump size to 0. rlimit rl; +#ifdef HAVE_ANDROID_OS + 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(); |