AndroidRuntime: Add flag to support tombstoned aided stack dumps.
We introduce a new property dalvik.vm.stack-trace-dir that indicates
that we're using one trace file per dump. The runtime does not need
to know what the directory is, since it will communicate with
tombstoned in order to obtain a file descriptor to which it will write
its traces. In this change, we set the -Xtombstonedtraces flag whenever
dalvik.vm.stack-trace-dir is set.
Test: Manual
Bug: 32064548
Change-Id: I05984e91658250ad8379b821ca31649f13868580
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 2b5c0d6..07f1b45 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -606,7 +606,6 @@
{
JavaVMInitArgs initArgs;
char propBuf[PROPERTY_VALUE_MAX];
- char stackTraceDirBuf[sizeof("-Xstacktracedir:")-1 + PROPERTY_VALUE_MAX];
char stackTraceFileBuf[sizeof("-Xstacktracefile:")-1 + PROPERTY_VALUE_MAX];
char jniOptsBuf[sizeof("-Xjniopts:")-1 + PROPERTY_VALUE_MAX];
char heapstartsizeOptsBuf[sizeof("-Xms")-1 + PROPERTY_VALUE_MAX];
@@ -687,7 +686,10 @@
// If dalvik.vm.stack-trace-dir is set, it enables the "new" stack trace
// dump scheme and a new file is created for each stack dump. If it isn't set,
// the old scheme is enabled.
- if (!parseRuntimeOption("dalvik.vm.stack-trace-dir", stackTraceDirBuf, "-Xstacktracedir:")) {
+ property_get("dalvik.vm.stack-trace-dir", propBuf, "");
+ if (strlen(propBuf) > 0) {
+ addOption("-Xusetombstonedtraces");
+ } else {
parseRuntimeOption("dalvik.vm.stack-trace-file", stackTraceFileBuf, "-Xstacktracefile:");
}