summaryrefslogtreecommitdiff
path: root/openjdkjvmti
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2021-01-27 16:14:30 -0800
committerTreehugger Robot <treehugger-gerrit@google.com>2021-01-29 18:08:20 +0000
commit0fba186013badc1526ae5c34e1e59c39f06ad43c (patch)
tree41d6c281a267623ccbf881ec9664acb43281540e /openjdkjvmti
parent60e0081a6b7ee2e6daafb0f82d3154ad86bcde71 (diff)
Add ERROR log with JVMTI version explanation
We semi-regularly get bugs where people report being unable to get JVMTI on non-debuggable processes running on userdebug/eng devices. This new log line will help anyone who hits this have a better idea of next steps hopefully. The confusion is mostly around assuming that if JVMTI isn't available the attachAgent function will throw and the Agent_OnAttach function will not be called. While this is true for 'user' builds on 'userdebug' and 'eng' we will allow the agent to start but if the processes is not debuggable only kArtTiVersion (0x70010200) jvmtiEnvs can be created. These envs have somewhat looser specifications then the normal jvmtiEnvs and are used to provide best-effort debugger support on userdebug, among other things. Test: manual Bug: 178033907 Change-Id: I03993ae5200e5d308180014f6fedb3d2062c0d77
Diffstat (limited to 'openjdkjvmti')
-rw-r--r--openjdkjvmti/OpenjdkJvmTi.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/openjdkjvmti/OpenjdkJvmTi.cc b/openjdkjvmti/OpenjdkJvmTi.cc
index a5c5df6cc9..09900e1f73 100644
--- a/openjdkjvmti/OpenjdkJvmTi.cc
+++ b/openjdkjvmti/OpenjdkJvmTi.cc
@@ -1438,6 +1438,13 @@ static jint GetEnvHandler(art::JavaVMExt* vm, /*out*/void** env, jint version) {
return JNI_OK;
} else {
printf("version 0x%x is not valid!", version);
+ if (IsJvmtiVersion(version)) {
+ LOG(ERROR) << "JVMTI Version 0x" << std::hex << version << " requested but the runtime is not"
+ << " debuggable! Only limited, best effort kArtTiVersion"
+ << " (0x" << std::hex << kArtTiVersion << ") environments are available. If"
+ << " possible, rebuild your apk in debuggable mode or start the runtime with"
+ << " the `-Xcompiler-option --debuggable` flags.";
+ }
return JNI_EVERSION;
}
}