summaryrefslogtreecommitdiff
path: root/test/912-classes/classes.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/912-classes/classes.cc')
-rw-r--r--test/912-classes/classes.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/test/912-classes/classes.cc b/test/912-classes/classes.cc
index 5bd34f6be8..2636367548 100644
--- a/test/912-classes/classes.cc
+++ b/test/912-classes/classes.cc
@@ -16,19 +16,22 @@
#include <stdio.h>
-#include "base/macros.h"
+#include "android-base/macros.h"
+
#include "class_linker.h"
#include "jni.h"
#include "mirror/class_loader.h"
#include "jvmti.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
+#include "scoped_local_ref.h"
+#include "scoped_utf_chars.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-inl.h"
-#include "ti-agent/common_helper.h"
-#include "ti-agent/common_load.h"
+// Test infrastructure
+#include "jni_helper.h"
+#include "jvmti_helper.h"
+#include "test_env.h"
namespace art {
namespace Test912Classes {
@@ -233,7 +236,7 @@ extern "C" JNIEXPORT jobjectArray JNICALL Java_Main_getClassLoaderClasses(
jint count = 0;
jclass* classes = nullptr;
jvmtiError result = jvmti_env->GetClassLoaderClasses(jclassloader, &count, &classes);
- if (JvmtiErrorToException(env, result)) {
+ if (JvmtiErrorToException(env, jvmti_env, result)) {
return nullptr;
}
@@ -251,7 +254,7 @@ extern "C" JNIEXPORT jintArray JNICALL Java_Main_getClassVersion(
JNIEnv* env, jclass Main_klass ATTRIBUTE_UNUSED, jclass klass) {
jint major, minor;
jvmtiError result = jvmti_env->GetClassVersionNumbers(klass, &minor, &major);
- if (JvmtiErrorToException(env, result)) {
+ if (JvmtiErrorToException(env, jvmti_env, result)) {
return nullptr;
}
@@ -270,7 +273,7 @@ static std::string GetClassName(jvmtiEnv* jenv, JNIEnv* jni_env, jclass klass) {
jvmtiError result = jenv->GetClassSignature(klass, &name, nullptr);
if (result != JVMTI_ERROR_NONE) {
if (jni_env != nullptr) {
- JvmtiErrorToException(jni_env, result);
+ JvmtiErrorToException(jni_env, jenv, result);
} else {
printf("Failed to get class signature.\n");
}
@@ -291,13 +294,13 @@ static void EnableEvents(JNIEnv* env,
jvmtiError ret = jvmti_env->SetEventNotificationMode(JVMTI_DISABLE,
JVMTI_EVENT_CLASS_LOAD,
nullptr);
- if (JvmtiErrorToException(env, ret)) {
+ if (JvmtiErrorToException(env, jvmti_env, ret)) {
return;
}
ret = jvmti_env->SetEventNotificationMode(JVMTI_DISABLE,
JVMTI_EVENT_CLASS_PREPARE,
nullptr);
- JvmtiErrorToException(env, ret);
+ JvmtiErrorToException(env, jvmti_env, ret);
return;
}
@@ -306,20 +309,20 @@ static void EnableEvents(JNIEnv* env,
callbacks.ClassLoad = class_load;
callbacks.ClassPrepare = class_prepare;
jvmtiError ret = jvmti_env->SetEventCallbacks(&callbacks, sizeof(callbacks));
- if (JvmtiErrorToException(env, ret)) {
+ if (JvmtiErrorToException(env, jvmti_env, ret)) {
return;
}
ret = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_CLASS_LOAD,
nullptr);
- if (JvmtiErrorToException(env, ret)) {
+ if (JvmtiErrorToException(env, jvmti_env, ret)) {
return;
}
ret = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE,
JVMTI_EVENT_CLASS_PREPARE,
nullptr);
- JvmtiErrorToException(env, ret);
+ JvmtiErrorToException(env, jvmti_env, ret);
}
class ClassLoadPreparePrinter {
@@ -364,7 +367,7 @@ class ClassLoadPreparePrinter {
jvmtiError result = jenv->GetThreadInfo(thread, &info);
if (result != JVMTI_ERROR_NONE) {
if (jni_env != nullptr) {
- JvmtiErrorToException(jni_env, result);
+ JvmtiErrorToException(jni_env, jenv, result);
} else {
printf("Failed to get thread name.\n");
}