summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Orion Hodson <oth@google.com> 2018-12-07 16:44:33 +0000
committer Orion Hodson <oth@google.com> 2018-12-10 21:02:46 +0000
commit2b71ad0a26a7d30e99b9583acd75decfe0d2e4f8 (patch)
treef0e9f5af89e308a2d0bf25180d7217d69ab6d5b2
parent0882543a128a7f1289d54600dd48a4f2df3a30df (diff)
Add persist.zygote.core_dump property for coredumps
Enable core dumps for debuggable apps if the property is set. Contributed by lu.wang@unisoc.com. Bug: b/120485385 Test: boots Change-Id: I68995bec552b8875490748ee5275488f65b00dbd
-rw-r--r--core/jni/com_android_internal_os_Zygote.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 7a3f49a3efac..01105ba04be3 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -273,15 +273,17 @@ static void EnableDebugger() {
}
}
- // We don't want core dumps, though, so set the soft limit on core dump size
- // to 0 without changing the hard limit.
- rlimit rl;
- if (getrlimit(RLIMIT_CORE, &rl) == -1) {
- ALOGE("getrlimit(RLIMIT_CORE) failed");
- } else {
- rl.rlim_cur = 0;
- if (setrlimit(RLIMIT_CORE, &rl) == -1) {
- ALOGE("setrlimit(RLIMIT_CORE) failed");
+ // Set the core dump size to zero unless wanted (see also coredump_setup in build/envsetup.sh).
+ if (!GetBoolProperty("persist.zygote.core_dump", false)) {
+ // Set the soft limit on core dump size to 0 without changing the hard limit.
+ rlimit rl;
+ if (getrlimit(RLIMIT_CORE, &rl) == -1) {
+ ALOGE("getrlimit(RLIMIT_CORE) failed");
+ } else {
+ rl.rlim_cur = 0;
+ if (setrlimit(RLIMIT_CORE, &rl) == -1) {
+ ALOGE("setrlimit(RLIMIT_CORE) failed");
+ }
}
}
}