Add flag to "am start" to enable native debugging
Specifying the new flag will enable several features in the runtime
required by the native debugger to debug Java and C++ code at the same
time.
The enabled features:
* Force JIT (never use the interpreter)
* Debug info generation
* Disbale some optimizations
Change-Id: Iaf5ab649715a0c274bd1b0fc64e483705da53cd0
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 82170d1..dc37a57 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -245,6 +245,13 @@
public static final int START_FLAG_TRACK_ALLOCATION = 1<<2;
/**
+ * Flag for IActivityManaqer.startActivity: launch the app with
+ * native debugging support.
+ * @hide
+ */
+ public static final int START_FLAG_NATIVE_DEBUGGING = 1<<3;
+
+ /**
* Result for IActivityManaqer.broadcastIntent: success!
* @hide
*/
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 1e4ee4b..fe2dfdf 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -647,6 +647,12 @@
if ((debugFlags & Zygote.DEBUG_GENERATE_DEBUG_INFO) != 0) {
argsForZygote.add("--generate-debug-info");
}
+ if ((debugFlags & Zygote.DEBUG_ALWAYS_JIT) != 0) {
+ argsForZygote.add("--always-jit");
+ }
+ if ((debugFlags & Zygote.DEBUG_NATIVE_DEBUGGABLE) != 0) {
+ argsForZygote.add("--native-debuggable");
+ }
if ((debugFlags & Zygote.DEBUG_ENABLE_ASSERT) != 0) {
argsForZygote.add("--enable-assert");
}
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index d23f26d..919254a 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -41,6 +41,10 @@
public static final int DEBUG_ENABLE_JNI_LOGGING = 1 << 4;
/** Force generation of native debugging information. */
public static final int DEBUG_GENERATE_DEBUG_INFO = 1 << 5;
+ /** Always use JIT-ed code. */
+ public static final int DEBUG_ALWAYS_JIT = 1 << 6;
+ /** Make the code debuggable with turning off some optimizations. */
+ public static final int DEBUG_NATIVE_DEBUGGABLE = 1 << 7;
/** No external storage should be mounted. */
public static final int MOUNT_EXTERNAL_NONE = 0;
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index a40f9a8..85d84bb 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -434,6 +434,10 @@
debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
} else if (arg.equals("--generate-debug-info")) {
debugFlags |= Zygote.DEBUG_GENERATE_DEBUG_INFO;
+ } else if (arg.equals("--always-jit")) {
+ debugFlags |= Zygote.DEBUG_ALWAYS_JIT;
+ } else if (arg.equals("--native-debuggable")) {
+ debugFlags |= Zygote.DEBUG_NATIVE_DEBUGGABLE;
} else if (arg.equals("--enable-jni-logging")) {
debugFlags |= Zygote.DEBUG_ENABLE_JNI_LOGGING;
} else if (arg.equals("--enable-assert")) {