Add support for selecting alternate JDWP implementations

Change the '-Xagentlib:jdwp=...' option to instead use the new
'-XjdwpOptions:...' syntax and remove the explicit transport-lib.

Add a '-XjdwpProvider:...' option. Set it to 'default' by default and
get its value from the 'dalvik.vm.jdwp-provider' property.

Test: Boots. Can debug apps
Test: Set dalvik.vm.jdwp-provider=adbconnection, stop, start, debug

Bug: 62821960
Change-Id: I1605030b94b38676c18885fcf2fa3490bccd3e0d
This commit is contained in:
Alex Light
2017-11-20 13:01:01 -08:00
parent 11ec2eb118
commit fffb273aff

View File

@@ -643,6 +643,7 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool zygote)
char methodTraceFileBuf[sizeof("-Xmethod-trace-file:") + PROPERTY_VALUE_MAX];
char methodTraceFileSizeBuf[sizeof("-Xmethod-trace-file-size:") + PROPERTY_VALUE_MAX];
std::string fingerprintBuf;
char jdwpProviderBuf[sizeof("-XjdwpProvider:") - 1 + PROPERTY_VALUE_MAX];
bool checkJni = false;
property_get("dalvik.vm.checkjni", propBuf, "");
@@ -765,9 +766,15 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv, bool 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");
addOption("-XjdwpOptions:suspend=n,server=y");
}
// Set the JDWP provider. By default let the runtime choose.
parseRuntimeOption("dalvik.vm.jdwp-provider",
jdwpProviderBuf,
"-XjdwpProvider:",
"default");
parseRuntimeOption("dalvik.vm.lockprof.threshold",
lockProfThresholdBuf,
"-Xlockprofthreshold:");