diff options
author | 2017-08-16 16:07:37 -0700 | |
---|---|---|
committer | 2017-08-16 16:18:12 -0700 | |
commit | bf9e516f4964ee900d2996abaf60977c1c643aa3 (patch) | |
tree | 0656e7a0c692ca4539c67ea1684dfbe7a6f95048 /test/901-hello-ti-agent/basics.cc | |
parent | 675c779cb046bca49229e1e5268d0eb622159214 (diff) |
Ensure GetPhase returns correct values.
We were incorrectly waiting until after the kInit and kStart runtime
phase callbacks to change the current runtime phase. The phase should
have already changed by the time the VMInit and VMStart are
dispatched.
Test: ./test.py --host -j50
Change-Id: I959221025a6692f2244048aa852170bb70dc2b7a
Diffstat (limited to 'test/901-hello-ti-agent/basics.cc')
-rw-r--r-- | test/901-hello-ti-agent/basics.cc | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/test/901-hello-ti-agent/basics.cc b/test/901-hello-ti-agent/basics.cc index 2edd91eb66..472f2b768e 100644 --- a/test/901-hello-ti-agent/basics.cc +++ b/test/901-hello-ti-agent/basics.cc @@ -38,20 +38,27 @@ static void EnableEvent(jvmtiEnv* env, jvmtiEvent evt) { } } -static void JNICALL VMStartCallback(jvmtiEnv *jenv ATTRIBUTE_UNUSED, - JNIEnv* jni_env ATTRIBUTE_UNUSED) { - printf("VMStart\n"); +static jvmtiPhase getPhase(jvmtiEnv* jenv) { + jvmtiPhase out = static_cast<jvmtiPhase>(-1); + jenv->GetPhase(&out); + return out; } -static void JNICALL VMInitCallback(jvmtiEnv *jvmti_env ATTRIBUTE_UNUSED, +static void JNICALL VMStartCallback(jvmtiEnv *jenv, JNIEnv* jni_env ATTRIBUTE_UNUSED) { + printf("VMStart (phase %d)\n", getPhase(jenv)); + fsync(1); +} + +static void JNICALL VMInitCallback(jvmtiEnv *jvmti_env, JNIEnv* jni_env ATTRIBUTE_UNUSED, jthread thread ATTRIBUTE_UNUSED) { - printf("VMInit\n"); + printf("VMInit (phase %d)\n", getPhase(jvmti_env)); + fsync(1); } -static void JNICALL VMDeatchCallback(jvmtiEnv *jenv ATTRIBUTE_UNUSED, - JNIEnv* jni_env ATTRIBUTE_UNUSED) { - printf("VMDeath\n"); +static void JNICALL VMDeatchCallback(jvmtiEnv *jenv, JNIEnv* jni_env ATTRIBUTE_UNUSED) { + printf("VMDeath (phase %d)\n", getPhase(jenv)); + fsync(1); } |