am ff8dc212
: Allow debugging only for apps forked from zygote
* commit 'ff8dc21278b19b22ed8dc9f9475850838336d351': Allow debugging only for apps forked from zygote
This commit is contained in:
@ -304,9 +304,9 @@ int main(int argc, char* const argv[])
|
||||
}
|
||||
|
||||
if (zygote) {
|
||||
runtime.start("com.android.internal.os.ZygoteInit", args);
|
||||
runtime.start("com.android.internal.os.ZygoteInit", args, zygote);
|
||||
} else if (className) {
|
||||
runtime.start("com.android.internal.os.RuntimeInit", args);
|
||||
runtime.start("com.android.internal.os.RuntimeInit", args, zygote);
|
||||
} else {
|
||||
fprintf(stderr, "Error: no class name or --zygote supplied.\n");
|
||||
app_usage();
|
||||
|
@ -528,7 +528,7 @@ bool AndroidRuntime::parseCompilerRuntimeOption(const char* property,
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
|
||||
int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
|
||||
{
|
||||
int result = -1;
|
||||
JavaVMInitArgs initArgs;
|
||||
@ -733,9 +733,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
|
||||
}
|
||||
}
|
||||
|
||||
/* enable debugging; set suspend=y to pause during VM init */
|
||||
/* use android ADB transport */
|
||||
/*
|
||||
* Enable debugging only for apps forked from zygote.
|
||||
* Set suspend=y to pause during VM init and use android ADB transport.
|
||||
*/
|
||||
if (zygote) {
|
||||
addOption("-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y");
|
||||
}
|
||||
|
||||
parseRuntimeOption("dalvik.vm.lockprof.threshold",
|
||||
lockProfThresholdBuf,
|
||||
@ -943,7 +947,7 @@ jstring AndroidRuntime::NewStringLatin1(JNIEnv* env, const char* bytes) {
|
||||
* Passes the main function two arguments, the class name and the specified
|
||||
* options string.
|
||||
*/
|
||||
void AndroidRuntime::start(const char* className, const Vector<String8>& options)
|
||||
void AndroidRuntime::start(const char* className, const Vector<String8>& options, bool zygote)
|
||||
{
|
||||
ALOGD("\n>>>>>> AndroidRuntime START %s <<<<<<\n",
|
||||
className != NULL ? className : "(unknown)");
|
||||
@ -979,7 +983,7 @@ void AndroidRuntime::start(const char* className, const Vector<String8>& options
|
||||
JniInvocation jni_invocation;
|
||||
jni_invocation.Init(NULL);
|
||||
JNIEnv* env;
|
||||
if (startVm(&mJavaVM, &env) != 0) {
|
||||
if (startVm(&mJavaVM, &env, zygote) != 0) {
|
||||
return;
|
||||
}
|
||||
onVmCreated(env);
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
*/
|
||||
static jclass findClass(JNIEnv* env, const char* className);
|
||||
|
||||
void start(const char *classname, const Vector<String8>& options);
|
||||
void start(const char *classname, const Vector<String8>& options, bool zygote);
|
||||
|
||||
void exit(int code);
|
||||
|
||||
@ -131,7 +131,7 @@ private:
|
||||
const char* runtimeArg,
|
||||
const char* quotingArg);
|
||||
void parseExtraOpts(char* extraOptsBuf, const char* quotingArg);
|
||||
int startVm(JavaVM** pJavaVM, JNIEnv** pEnv);
|
||||
int startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote);
|
||||
|
||||
Vector<JavaVMOption> mOptions;
|
||||
bool mExitWithoutCleanup;
|
||||
|
Reference in New Issue
Block a user