8324681: Replace NULL with nullptr in HotSpot jtreg test native code files

Reviewed-by: kevinw, kbarrett, dholmes
This commit is contained in:
Coleen Phillimore 2024-01-29 17:07:32 +00:00
parent 951b5f8ecb
commit a6bdee48f3
750 changed files with 8208 additions and 8215 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
static jrawMonitorID monitor;
JNIEXPORT jint JNICALL

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
#define LOG(...) \
do { \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
#define LOG(...) \
do { \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,38 +39,38 @@ static jfieldID test_A_f_id;
extern "C" {
JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_init(JNIEnv* env, jclass cls) {
jclass runnable = env->FindClass("java/lang/Runnable");
if (runnable == NULL) return JNI_FALSE;
if (runnable == nullptr) return JNI_FALSE;
methodId = env->GetMethodID(runnable, "run", "()V");
if (methodId == NULL) return JNI_FALSE;
if (methodId == nullptr) return JNI_FALSE;
return JNI_TRUE;
}
JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_00024Test_00024A_init(JNIEnv* env, jclass cls, jclass arg1) {
test_class_A = (jclass)env->NewGlobalRef(cls);
if (test_class_A == NULL) return JNI_FALSE;
if (test_class_A == nullptr) return JNI_FALSE;
test_class_B = (jclass)env->NewGlobalRef(arg1);
if (test_class_B == NULL) return JNI_FALSE;
if (test_class_B == nullptr) return JNI_FALSE;
test_staticM_id = env->GetStaticMethodID(test_class_A, "staticM", "(Ljava/lang/Runnable;)V");
if (test_staticM_id == NULL) return JNI_FALSE;
if (test_staticM_id == nullptr) return JNI_FALSE;
test_staticS_id = env->GetStaticMethodID(test_class_A, "staticS", "(Ljava/lang/Runnable;)V");
if (test_staticS_id == NULL) return JNI_FALSE;
if (test_staticS_id == nullptr) return JNI_FALSE;
test_staticN_id = env->GetStaticMethodID(test_class_A, "staticN", "(Ljava/lang/Runnable;)V");
if (test_staticN_id == NULL) return JNI_FALSE;
if (test_staticN_id == nullptr) return JNI_FALSE;
test_A_m_id = env->GetMethodID(test_class_A, "m", "()V");
if (test_A_m_id == NULL) return JNI_FALSE;
if (test_A_m_id == nullptr) return JNI_FALSE;
test_staticF_id = env->GetStaticFieldID(test_class_A, "staticF", "I");
if (test_staticF_id == NULL) return JNI_FALSE;
if (test_staticF_id == nullptr) return JNI_FALSE;
test_A_f_id = env->GetFieldID(test_class_A, "f", "I");
if (test_A_f_id == NULL) return JNI_FALSE;
if (test_A_f_id == nullptr) return JNI_FALSE;
return JNI_TRUE;
}
@ -105,11 +105,11 @@ extern "C" {
JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceAJNI(JNIEnv* env, jclass cls, jobject action) {
jobject obj = env->AllocObject(test_class_A); // A obj = new A();
if (env->ExceptionOccurred()) {
return NULL;
} else if (obj == NULL) {
return nullptr;
} else if (obj == nullptr) {
jclass errorClass = env->FindClass("java/lang/AssertionError");
int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown");
return NULL;
return nullptr;
}
env->CallVoidMethod(action, methodId); // action.run();
return obj;
@ -118,11 +118,11 @@ extern "C" {
JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceBJNI(JNIEnv* env, jclass cls, jobject action) {
jobject obj = env->AllocObject(test_class_B); // B obj = new B();
if (env->ExceptionOccurred()) {
return NULL;
} else if (obj == NULL) {
return nullptr;
} else if (obj == nullptr) {
jclass errorClass = env->FindClass("java/lang/AssertionError");
int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown");
return NULL;
return nullptr;
}
env->CallVoidMethod(action, methodId); // action.run();
return obj;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, Google and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -35,7 +35,7 @@ template <class T>
class JvmtiDeallocator {
public:
JvmtiDeallocator() {
elem_ = NULL;
elem_ = nullptr;
}
~JvmtiDeallocator() {
@ -100,7 +100,7 @@ extern "C" {
static
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -129,13 +129,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
if (err != JVMTI_ERROR_NONE) {
fprintf(stderr, "AgentInitialize: Error in SetEventNotificationMode for CLASS_LOAD: %d\n", err);
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr);
if (err != JVMTI_ERROR_NONE) {
fprintf(stderr,
"AgentInitialize: Error in SetEventNotificationMode for CLASS_PREPARE: %d\n",
@ -143,7 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
fprintf(
stderr, "AgentInitialize: Error in SetEventNotificationMode for VM_INIT: %d\n",
@ -194,12 +194,12 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls)
trace.env_id = env;
trace.num_frames = 0;
if (agct == NULL) {
if (agct == nullptr) {
fprintf(stderr, "AsyncGetCallTrace not found.\n");
return false;
}
agct(&trace, MAX_DEPTH, NULL);
agct(&trace, MAX_DEPTH, nullptr);
// For now, just check that the first frame is (-3, checkAsyncGetCallTraceCall).
if (trace.num_frames <= 0) {
@ -214,19 +214,19 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls)
}
JvmtiDeallocator<char*> name;
if (trace.frames[0].method_id == NULL) {
fprintf(stderr, "First frame method_id is NULL\n");
if (trace.frames[0].method_id == nullptr) {
fprintf(stderr, "First frame method_id is null\n");
return false;
}
jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), NULL, NULL);
jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), nullptr, nullptr);
if (err != JVMTI_ERROR_NONE) {
fprintf(stderr, "checkAsyncGetCallTrace: Error in GetMethodName: %d\n", err);
return false;
}
if (name.get() == NULL) {
fprintf(stderr, "Name is NULL\n");
if (name.get() == nullptr) {
fprintf(stderr, "Name is null\n");
return false;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ void JNICALL CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
// Continuously generate CompiledMethodLoad events for all currently compiled methods
void JNICALL GenerateEventsThread(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr);
int count = 0;
while (true) {
@ -64,7 +64,7 @@ void JNICALL VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
jmethodID thread_constructor = jni->GetMethodID(thread_class, "<init>", "()V");
jthread agent_thread = jni->NewObject(thread_class, thread_constructor);
jvmti->RunAgentThread(agent_thread, GenerateEventsThread, NULL, JVMTI_THREAD_NORM_PRIORITY);
jvmti->RunAgentThread(agent_thread, GenerateEventsThread, nullptr, JVMTI_THREAD_NORM_PRIORITY);
}
JNIEXPORT
@ -83,7 +83,7 @@ jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
callbacks.VMInit = VMInit;
callbacks.CompiledMethodLoad = CompiledMethodLoad;
jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,7 @@
#include <jvmti.h>
#include "jvmti_common.h"
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
#ifdef __cplusplus
extern "C" {
@ -34,8 +34,8 @@ extern "C" {
JNIEXPORT
void JNICALL Java_DynamicCodeGeneratedTest_changeEventNotificationMode(JNIEnv* jni, jclass cls) {
while (true) {
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL);
jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr);
jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,9 +28,9 @@ extern "C" {
#define AGENT_NAME "agent1"
static JavaVM *java_vm = NULL;
static jthread exp_thread = NULL;
static jvmtiEnv *jvmti1 = NULL;
static JavaVM *java_vm = nullptr;
static jthread exp_thread = nullptr;
static jvmtiEnv *jvmti1 = nullptr;
static jint agent1_event_count = 0;
static bool fail_status = false;
@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
jint code_size, const void* code_addr,
jint map_length, const jvmtiAddrLocationMap* map,
const void* compile_info) {
JNIEnv* env = NULL;
jthread thread = NULL;
char* name = NULL;
char* sign = NULL;
JNIEnv* env = nullptr;
jthread thread = nullptr;
char* name = nullptr;
char* sign = nullptr;
jvmtiError err;
// Posted on JavaThread's, so it is legal to obtain JNIEnv*
@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
}
agent1_event_count++;
err = jvmti->GetMethodName(method, &name, &sign, NULL);
err = jvmti->GetMethodName(method, &name, &sign, nullptr);
check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName");
printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign);
@ -111,7 +111,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls) {
jthread thread = NULL;
jthread thread = nullptr;
jvmtiError err;
err = jvmti1->GetCurrentThread(&thread);
@ -119,13 +119,13 @@ Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls)
exp_thread = (jthread)env->NewGlobalRef(thread);
err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr);
check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE");
err = jvmti1->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD);
check_jvmti_status(env, err, "generateEvents1: Error in JVMTI GenerateEvents");
err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr);
check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,9 +28,9 @@ extern "C" {
#define AGENT_NAME "agent2"
static JavaVM *java_vm = NULL;
static jthread exp_thread = NULL;
static jvmtiEnv *jvmti2 = NULL;
static JavaVM *java_vm = nullptr;
static jthread exp_thread = nullptr;
static jvmtiEnv *jvmti2 = nullptr;
static jint agent2_event_count = 0;
static bool fail_status = false;
@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
jint code_size, const void* code_addr,
jint map_length, const jvmtiAddrLocationMap* map,
const void* compile_info) {
JNIEnv* env = NULL;
jthread thread = NULL;
char* name = NULL;
char* sign = NULL;
JNIEnv* env = nullptr;
jthread thread = nullptr;
char* name = nullptr;
char* sign = nullptr;
jvmtiError err;
// Posted on JavaThread's, so it is legal to obtain JNIEnv*
@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method,
}
agent2_event_count++;
err = jvmti->GetMethodName(method, &name, &sign, NULL);
err = jvmti->GetMethodName(method, &name, &sign, nullptr);
check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName");
printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign);
@ -113,7 +113,7 @@ Java_MyPackage_GenerateEventsTest_agent2SetThread(JNIEnv *env, jclass cls, jthre
exp_thread = (jthread)env->NewGlobalRef(thread);
err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr);
check_jvmti_status(env, err, "setThread2: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE");
}
@ -121,7 +121,7 @@ JNIEXPORT jboolean JNICALL
Java_MyPackage_GenerateEventsTest_agent2FailStatus(JNIEnv *env, jclass cls) {
jvmtiError err;
err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL);
err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr);
check_jvmti_status(env, err, "check2: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE");
printf("\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,12 +28,12 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
printf("Wrong result of a valid call to GetEnv!\n");
fflush(0);
return JNI_ERR;
@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *jvm, char *options, void *reserved
JNIEXPORT jint JNICALL
Java_FilteredFieldsTest_getJVMTIFieldCount(JNIEnv *env, jclass cls, jclass clazz) {
if (jvmti == NULL) {
if (jvmti == nullptr) {
env->FatalError("JVMTI agent was not properly loaded");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ extern "C" {
#define ACC_STATIC 0x0008
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
JNIEXPORT
jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
@ -41,7 +41,7 @@ jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) {
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
vm->GetEnv((void **)&jvmti, JVMTI_VERSION_11);
if (options != NULL && strcmp(options, "maintain_original_method_order") == 0) {
if (options != nullptr && strcmp(options, "maintain_original_method_order") == 0) {
printf("Enabled capability: maintain_original_method_order\n");
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
@ -58,22 +58,22 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIEnv *env, jclass static_klass, jclass klass) {
jint method_count = 0;
jmethodID* methods = NULL;
jmethodID* methods = nullptr;
jvmtiError err = jvmti->GetClassMethods(klass, &method_count, &methods);
if (err != JVMTI_ERROR_NONE) {
printf("GetClassMethods failed with error: %d\n", err);
return NULL;
return nullptr;
}
jclass method_cls = env->FindClass("java/lang/reflect/Method");
if (method_cls == NULL) {
if (method_cls == nullptr) {
printf("FindClass (Method) failed\n");
return NULL;
return nullptr;
}
jobjectArray array = env->NewObjectArray(method_count, method_cls, NULL);
if (array == NULL) {
jobjectArray array = env->NewObjectArray(method_count, method_cls, nullptr);
if (array == nullptr) {
printf("NewObjectArray failed\n");
return NULL;
return nullptr;
}
for (int i = 0; i < method_count; i++) {
@ -81,13 +81,13 @@ JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIE
err = jvmti->GetMethodModifiers(methods[i], &modifiers);
if (err != JVMTI_ERROR_NONE) {
printf("GetMethodModifiers failed with error: %d\n", err);
return NULL;
return nullptr;
}
jobject m = env->ToReflectedMethod(klass, methods[i], (modifiers & ACC_STATIC) == ACC_STATIC);
if (array == NULL) {
if (array == nullptr) {
printf("ToReflectedMethod failed\n");
return NULL;
return nullptr;
}
env->SetObjectArrayElement(array, i, m);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ extern "C" {
#define TranslateError(err) "JVMTI error"
static jint result = STATUS_PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
#define DECL_TEST_FUNC(type, Type) \
static void \
@ -167,7 +167,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
static jvmtiCapabilities caps;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
printf("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -223,16 +223,16 @@ Java_GetLocalVars_testLocals(JNIEnv *env, jclass cls, jobject thread) {
static const int IntSlot = 4;
static const int InvalidSlot = 5;
jmethodID mid = NULL;
jmethodID mid = nullptr;
if (jvmti == NULL) {
if (jvmti == nullptr) {
printf("JVMTI client was not properly loaded!\n");
result = STATUS_FAILED;
return;
}
mid = env->GetStaticMethodID(cls, METHOD_NAME, METHOD_SIGN);
if (mid == NULL) {
if (mid == nullptr) {
printf("Cannot find Method ID for %s%s\n", METHOD_NAME, METHOD_SIGN);
result = STATUS_FAILED;
return;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,7 @@ enum Slots {
SlotDouble = 6,
};
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static void
check_jvmti_error_not_suspended(JNIEnv* jni, const char* func_name, jvmtiError err) {
@ -55,7 +55,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
jvmtiError err;
const int depth = 0;
jobject msg = NULL;
jobject msg = nullptr;
jint ii = 0;
jlong ll = 0L;
jfloat ff = 0.0;
@ -101,7 +101,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
jvmtiError err;
const int depth = 0;
const jobject msg = NULL;
const jobject msg = nullptr;
const jint ii = 0;
const jlong ll = 0L;
const jfloat ff = 0.0;
@ -163,7 +163,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_GetSetLocalUnsuspended_testUnsuspendedThread(JNIEnv *jni, jclass klass, jthread thread) {
char* tname = get_thread_name(jvmti, jni, thread);
jmethodID method = NULL;
jmethodID method = nullptr;
jlocation location = 0;
LOG("\ntestUnsuspendedThread: started for thread: %s\n", tname);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, NTT DATA.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -35,7 +35,7 @@
extern "C" {
#endif
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return jvm->GetEnv(reinterpret_cast<void**>(&jvmti), JVMTI_VERSION_11);
@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv *
/* Find jvmtiStackInfo for `thread` (in arguments) */
jboolean is_same;
target_info = NULL;
target_info = nullptr;
for (jint i = 0; i < num_threads; i++) {
is_same = env->IsSameObject(stack_info[i].thread, thread);
if (env->ExceptionOccurred()) {
@ -115,7 +115,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv *
break;
}
}
if (target_info == NULL) {
if (target_info == nullptr) {
env->FatalError("Target thread not found");
}

View File

@ -64,7 +64,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) {
JNIEnv *env;
res = jvm->GetEnv((void **) &env, JNI_VERSION_9);
if (res != JNI_OK || env == NULL) {
if (res != JNI_OK || env == nullptr) {
fprintf(stderr, "Error: GetEnv call failed(%d)!\n", res);
return JNI_ERR;
}
@ -79,7 +79,7 @@ Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
printf("Agent_OnLoad started\n");
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -257,9 +257,9 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en
if (env->IsSameObject(method, method_IterateOverReachableObjects)) {
method_found = JNI_TRUE;
err = jvmti->IterateOverReachableObjects(NULL /*jvmtiHeapRootCallback*/,
err = jvmti->IterateOverReachableObjects(nullptr /*jvmtiHeapRootCallback*/,
__stackReferenceCallback,
NULL /* jvmtiObjectReferenceCallback */,
nullptr /* jvmtiObjectReferenceCallback */,
&data);
if (err != JVMTI_ERROR_NONE) {
ShowErrorMessage(jvmti, err,
@ -294,8 +294,8 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en
method_found = JNI_TRUE;
callbacks.heap_reference_callback = __jvmtiHeapReferenceCallback;
err = jvmti->FollowReferences(0 /* filter nothing */,
NULL /* no class filter */,
NULL /* no initial object, follow roots */,
nullptr /* no class filter */,
nullptr /* no initial object, follow roots */,
&callbacks,
&data);
if (err != JVMTI_ERROR_NONE) {
@ -308,7 +308,7 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en
method_found = JNI_TRUE;
callbacks.heap_iteration_callback = __jvmtiHeapIterationCallback;
err = jvmti->IterateThroughHeap(0 /* filter nothing */,
NULL /* no class filter */,
nullptr /* no class filter */,
&callbacks,
&data);
if (err != JVMTI_ERROR_NONE) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, Google and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -34,8 +34,8 @@ extern "C" {
#define FALSE 0
#define PRINT_OUT 0
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *second_jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEnv *second_jvmti = nullptr;
typedef struct _ObjectTrace{
jweak object;
@ -138,7 +138,7 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) {
// Get basic information out of the trace.
jlocation bci = frames[i].location;
jmethodID methodid = frames[i].method;
char *name = NULL, *signature = NULL, *file_name = NULL;
char *name = nullptr, *signature = nullptr, *file_name = nullptr;
jclass declaring_class;
int line_number;
jvmtiError err;
@ -166,18 +166,18 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) {
continue;
}
// Compare now, none should be NULL.
if (name == NULL) {
// Compare now, none should be null.
if (name == nullptr) {
fprintf(stderr, "\tUnknown name\n");
continue;
}
if (file_name == NULL) {
if (file_name == nullptr) {
fprintf(stderr, "\tUnknown file\n");
continue;
}
if (signature == NULL) {
if (signature == nullptr) {
fprintf(stderr, "\tUnknown signature\n");
continue;
}
@ -204,7 +204,7 @@ static jboolean check_sample_content(JNIEnv* env,
// Get basic information out of the trace.
jlocation bci = frames[i].location;
jmethodID methodid = frames[i].method;
char *name = NULL, *signature = NULL, *file_name = NULL;
char *name = nullptr, *signature = nullptr, *file_name = nullptr;
jclass declaring_class;
int line_number;
jboolean differ;
@ -227,16 +227,16 @@ static jboolean check_sample_content(JNIEnv* env,
return FALSE;
}
// Compare now, none should be NULL.
if (name == NULL) {
// Compare now, none should be null.
if (name == nullptr) {
return FALSE;
}
if (file_name == NULL) {
if (file_name == nullptr) {
return FALSE;
}
if (signature == NULL) {
if (signature == nullptr) {
return FALSE;
}
@ -267,14 +267,14 @@ static int fill_native_frames(JNIEnv* env, jobjectArray frames,
ExpectedContentFrame* native_frames, size_t size) {
size_t i;
for (i = 0; i < size; i++) {
jclass frame_class = NULL;
jclass frame_class = nullptr;
jfieldID line_number_field_id = 0;
int line_number = 0;
jfieldID string_id = 0;
jstring string_object = NULL;
const char* method = NULL;
const char* file_name = NULL;
const char* signature = NULL;
jstring string_object = nullptr;
const char* method = nullptr;
const char* file_name = nullptr;
const char* signature = nullptr;
jobject obj = env->GetObjectArrayElement(frames, (jsize) i);
@ -410,7 +410,7 @@ static void event_storage_add_garbage_collected_object(EventStorage* storage,
ObjectTrace* object) {
int idx = storage->garbage_history_index;
ObjectTrace* old_object = storage->garbage_collected_objects[idx];
if (old_object != NULL) {
if (old_object != nullptr) {
free(old_object->frames);
free(storage->garbage_collected_objects[idx]);
}
@ -496,7 +496,7 @@ static jboolean event_storage_garbage_contains(JNIEnv* env,
for (i = 0; i < storage->garbage_history_size; i++) {
ObjectTrace* trace = storage->garbage_collected_objects[i];
if (trace == NULL) {
if (trace == nullptr) {
continue;
}
@ -587,14 +587,14 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) {
ObjectTrace* live_object = live_objects[i];
jweak object = live_object->object;
if (!jni->IsSameObject(object, NULL)) {
if (!jni->IsSameObject(object, nullptr)) {
if (dest != i) {
live_objects[dest] = live_object;
dest++;
}
} else {
jni->DeleteWeakGlobalRef(object);
live_object->object = NULL;
live_object->object = nullptr;
event_storage_add_garbage_collected_object(storage, live_object);
}
@ -607,7 +607,7 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) {
static void event_storage_free_objects(ObjectTrace** array, int max) {
int i;
for (i = 0; i < max; i++) {
free(array[i]), array[i] = NULL;
free(array[i]), array[i] = nullptr;
}
}
@ -620,7 +620,7 @@ static void event_storage_reset(EventStorage* storage) {
storage->live_object_additions = 0;
storage->live_object_size = 0;
storage->live_object_count = 0;
free(storage->live_objects), storage->live_objects = NULL;
free(storage->live_objects), storage->live_objects = nullptr;
event_storage_free_objects(storage->garbage_collected_objects,
storage->garbage_history_size);
@ -799,13 +799,13 @@ void JNICALL GarbageCollectionFinish(jvmtiEnv *jvmti_env) {
static int enable_notifications() {
if (check_error(jvmti->SetEventNotificationMode(
JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL),
JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr),
"Set event notifications")) {
return 1;
}
return check_error(jvmti->SetEventNotificationMode(
JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL),
JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr),
"Set event notifications");
}
@ -816,14 +816,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiCapabilities caps;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
// Get second jvmti environment.
res = jvm->GetEnv((void **) &second_jvmti, JVMTI_VERSION);
if (res != JNI_OK || second_jvmti == NULL) {
if (res != JNI_OK || second_jvmti == nullptr) {
fprintf(stderr, "Error: wrong result of a valid second call to GetEnv!\n");
return JNI_ERR;
}
@ -893,11 +893,11 @@ Java_MyPackage_HeapMonitor_enableSamplingEvents(JNIEnv* env, jclass cls) {
JNIEXPORT void JNICALL
Java_MyPackage_HeapMonitor_disableSamplingEvents(JNIEnv* env, jclass cls) {
check_error(jvmti->SetEventNotificationMode(
JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL),
JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr),
"Set event notifications");
check_error(jvmti->SetEventNotificationMode(
JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL),
JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr),
"Garbage Collection Finish");
}
@ -912,8 +912,8 @@ static ExpectedContentFrame *get_native_frames(JNIEnv* env, jclass cls,
native_frames = reinterpret_cast<ExpectedContentFrame*> (malloc(size * sizeof(*native_frames)));
if (native_frames == NULL) {
env->FatalError("Error in get_native_frames: malloc returned NULL\n");
if (native_frames == nullptr) {
env->FatalError("Error in get_native_frames: malloc returned null\n");
}
if (fill_native_frames(env, frames, native_frames, size) != 0) {
@ -934,7 +934,7 @@ Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls,
result = event_storage_contains(env, &global_event_storage, native_frames,
size, check_lines);
free(native_frames), native_frames = NULL;
free(native_frames), native_frames = nullptr;
return result;
}
@ -949,7 +949,7 @@ Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls,
result = event_storage_garbage_contains(env, &global_event_storage,
native_frames, size, check_lines);
free(native_frames), native_frames = NULL;
free(native_frames), native_frames = nullptr;
return result;
}
@ -964,7 +964,7 @@ Java_MyPackage_HeapMonitor_getSize(JNIEnv* env, jclass cls,
result = event_storage_get_size(env, &global_event_storage,
native_frames, size, check_lines);
free(native_frames), native_frames = NULL;
free(native_frames), native_frames = nullptr;
return result;
}
@ -1083,7 +1083,7 @@ Java_MyPackage_HeapMonitorTwoAgentsTest_enablingSamplingInSecondaryAgent(
JNIEXPORT void JNICALL
Java_MyPackage_HeapMonitor_enableVMEvents(JNIEnv* env, jclass cls) {
check_error(jvmti->SetEventNotificationMode(
JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL),
JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr),
"Set vm event notifications");
}
@ -1103,19 +1103,19 @@ static jobject allocate_object(JNIEnv* env) {
jmethodID constructor;
jobject result;
if (env->ExceptionOccurred() || cls == NULL) {
if (env->ExceptionOccurred() || cls == nullptr) {
env->FatalError("Error in jni FindClass: Cannot find Object class\n");
}
constructor = env->GetMethodID(cls, "<init>", "()V");
if (env->ExceptionOccurred() || constructor == NULL) {
if (env->ExceptionOccurred() || constructor == nullptr) {
env->FatalError("Error in jni GetMethodID: Cannot find Object class constructor\n");
}
// Call back constructor to allocate a new instance, with an int argument
result = env->NewObject(cls, constructor);
if (env->ExceptionOccurred() || result == NULL) {
if (env->ExceptionOccurred() || result == nullptr) {
env->FatalError("Error in jni NewObject: Cannot allocate an object\n");
}
return result;
@ -1135,8 +1135,8 @@ void JNICALL RecursiveSampledObjectAlloc(jvmtiEnv *jvmti_env,
// infinite recursion here.
int i;
for (i = 0; i < 1000; i++) {
if (allocate_object(jni_env) == NULL) {
jni_env->FatalError("allocate_object returned NULL\n");
if (allocate_object(jni_env) == nullptr) {
jni_env->FatalError("allocate_object returned null\n");
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ static const char* SIG_START = "LP/Q/HiddenClassSig";
static const size_t SIG_START_LEN = strlen(SIG_START);
static const int ACC_INTERFACE = 0x0200; // Interface class modifiers bit
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint class_load_count = 0;
static jint class_prep_count = 0;
static bool failed = false;
@ -50,18 +50,18 @@ static bool failed = false;
/* Return the jmethodID of j.l.Class.isHidden() method. */
static jmethodID
is_hidden_mid(JNIEnv* jni) {
char* csig = NULL;
char* csig = nullptr;
jint count = 0;
jmethodID *methods = NULL;
jmethodID *methods = nullptr;
jclass clazz = jni->FindClass("java/lang/Class");
if (clazz == NULL) {
jni->FatalError("is_hidden_mid: Error: FindClass returned NULL for java/lang/Class\n");
return NULL;
if (clazz == nullptr) {
jni->FatalError("is_hidden_mid: Error: FindClass returned null for java/lang/Class\n");
return nullptr;
}
// find the jmethodID of j.l.Class.isHidden() method
jmethodID mid = jni->GetMethodID(clazz, "isHidden", "()Z");
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("is_hidden_mid: Error in jni GetMethodID: Cannot find j.l.Class.isHidden method\n");
}
return mid;
@ -70,9 +70,9 @@ is_hidden_mid(JNIEnv* jni) {
/* Return true if the klass is hidden. */
static bool
is_hidden(JNIEnv* jni, jclass klass) {
static jmethodID is_hid_mid = NULL;
static jmethodID is_hid_mid = nullptr;
if (is_hid_mid == NULL) {
if (is_hid_mid == nullptr) {
is_hid_mid = is_hidden_mid(jni);
}
// invoke j.l.Class.isHidden() method
@ -88,8 +88,8 @@ is_hidden(JNIEnv* jni, jclass klass) {
static void
check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden, const char* exp_sig) {
jint class_modifiers = 0;
char* sig = NULL;
char* gsig = NULL;
char* sig = nullptr;
char* gsig = nullptr;
jvmtiError err;
// get class signature
@ -103,8 +103,8 @@ check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden
LOG2("check_class_signature: FAIL: Hidden class signature %s does not match expected: %s\n", sig, exp_sig);
failed = true;
}
if (is_hidden && gsig == NULL) {
LOG0("check_class_signature: FAIL: unexpected NULL generic signature for hidden class\n");
if (is_hidden && gsig == nullptr) {
LOG0("check_class_signature: FAIL: unexpected null generic signature for hidden class\n");
failed = true;
}
}
@ -152,8 +152,8 @@ check_hidden_class_flags(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
static void
check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
jint count = 0;
jobject loader = NULL;
jclass* loader_classes = NULL;
jobject loader = nullptr;
jclass* loader_classes = nullptr;
jboolean found = false;
jvmtiError err;
@ -166,7 +166,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassLoaderClasses");
for (int idx = 0; idx < count; idx++) {
char* sig = NULL;
char* sig = nullptr;
jclass kls = loader_classes[idx];
// GetClassLoaderClasses should not return any hidden classes
@ -174,7 +174,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
continue;
}
// get class signature
err = jvmti->GetClassSignature(kls, &sig, NULL);
err = jvmti->GetClassSignature(kls, &sig, nullptr);
CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassSignature");
LOG1("check_hidden_class_loader: FAIL: JVMTI GetClassLoaderClasses returned hidden class: %s\n", sig);
@ -187,9 +187,9 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
/* Test the hidden class implements expected interface. */
static void
check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
char* sig = NULL;
char* sig = nullptr;
jint count = 0;
jclass* interfaces = NULL;
jclass* interfaces = nullptr;
jvmtiError err;
// check that hidden class implements just one interface
@ -201,7 +201,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
return;
}
// get interface signature
err = jvmti->GetClassSignature(interfaces[0], &sig, NULL);
err = jvmti->GetClassSignature(interfaces[0], &sig, nullptr);
CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_impl_interf: Error in JVMTI GetClassSignature for implemented interface");
// check the interface signature is matching the expected
@ -215,7 +215,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) {
/* Test hidden class. */
static void
check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_sig) {
char* source_file_name = NULL;
char* source_file_name = nullptr;
LOG1("\n### Native agent: check_hidden_class started: class: %s\n", exp_sig);
@ -237,7 +237,7 @@ check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_s
/* Test hidden class array. */
static void
check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const char* exp_sig) {
char* source_file_name = NULL;
char* source_file_name = nullptr;
LOG1("\n### Native agent: check_hidden_class_array started: array: %s\n", exp_sig);
@ -250,8 +250,8 @@ check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const
/* Process a CLASS_LOAD or aClassPrepare event. */
static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass,
jint* event_count_ptr, const char* event_name) {
char* sig = NULL;
char* gsig = NULL;
char* sig = nullptr;
char* gsig = nullptr;
jvmtiError err;
// get class signature
@ -263,8 +263,8 @@ static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass,
strncmp(sig, SIG_START, SIG_START_LEN) == 0 &&
is_hidden(jni, klass)) {
(*event_count_ptr)++;
if (gsig == NULL) {
LOG1("%s event: FAIL: GetClassSignature returned NULL generic signature for hidden class\n", event_name);
if (gsig == nullptr) {
LOG1("%s event: FAIL: GetClassSignature returned null generic signature for hidden class\n", event_name);
failed = true;
}
LOG2("%s event: hidden class with sig: %s\n", event_name, sig);
@ -293,11 +293,11 @@ VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
fflush(stdout);
// enable ClassLoad event notification mode
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassLoad events notification");
// enable ClassPrepare event notification mode
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr);
CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassPrepare events notification");
}
@ -327,7 +327,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
// enable VM_INIT event notification mode
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG1("Agent_OnLoad: Error in JVMTI SetEventNotificationMode: %d\n", err);
failed = true;
@ -341,10 +341,10 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
/* Native method: checkHiddenClass(). */
JNIEXPORT void JNICALL
Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass hidden_klass, jstring exp_sig_str) {
const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL);
const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr);
if (exp_sig == NULL) {
jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned NULL for jstring\n");
if (exp_sig == nullptr) {
jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned null for jstring\n");
return;
}
check_hidden_class(jvmti, jni, hidden_klass, exp_sig);
@ -355,10 +355,10 @@ Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass h
/* Native method: checkHiddenClassArray(). */
JNIEXPORT void JNICALL
Java_P_Q_HiddenClassSigTest_checkHiddenClassArray(JNIEnv *jni, jclass klass, jclass hidden_klass_array, jstring exp_sig_str) {
const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL);
const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr);
if (exp_sig == NULL) {
jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned NULL for jstring\n");
if (exp_sig == nullptr) {
jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned null for jstring\n");
return;
}
check_hidden_class_array(jvmti, jni, hidden_klass_array, exp_sig);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,7 +62,7 @@ struct SavedClassBytes {
jbyteArray get(JNIEnv *env) {
if (bytes == nullptr) {
_log("SavedClassBytes: NULL\n");
_log("SavedClassBytes: null\n");
return nullptr;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -152,7 +152,7 @@ public:
jbyteArray getSavedHookClassBytes() {
if (savedClassBytes == nullptr) {
_log("%s: savedClassBytes is NULL\n", mode);
_log("%s: savedClassBytes is null\n", mode);
return nullptr;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,7 +28,7 @@
#define TARGET_CLASS_NAME "LTarget;"
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static void
check_jvmti_status(JNIEnv* jni, jvmtiError err, const char* msg) {
@ -42,7 +42,7 @@ void JNICALL classprepare(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread,
char* buf;
jvmtiError err;
err = jvmti->GetClassSignature(klass, &buf, NULL);
err = jvmti->GetClassSignature(klass, &buf, nullptr);
check_jvmti_status(jni_env, err, "classprepare: GetClassSignature error");
if (strncmp(buf, TARGET_CLASS_NAME, strlen(TARGET_CLASS_NAME)) == 0) {
@ -95,13 +95,13 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr);
if (err != JNI_OK) {
printf("Agent_OnLoad: SetEventNotificationMode CLASS_PREPARE error\n");
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
if (err != JNI_OK) {
printf("Agent_OnLoad: SetEventNotificationMode BREAKPOINT error\n");
return JNI_ERR;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
namespace {
jlong nextTag = 1;
jvmtiEnv *jvmti = NULL;
jvmtiEnv *jvmti = nullptr;
void checkJvmti(int code, const char* message) {
if (code != JVMTI_ERROR_NONE) {
@ -55,7 +55,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_TagMapTest_getTag(JNIEnv* jni_env, jclas
}
extern "C" JNIEXPORT void JNICALL Java_TagMapTest_iterate(JNIEnv* jni_env, jclass clazz, jboolean tagged) {
checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, NULL), "could not iterate");
checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, nullptr), "could not iterate");
}
extern "C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,8 +28,8 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jthread* threads = NULL;
static jvmtiEnv* jvmti = nullptr;
static jthread* threads = nullptr;
static jsize threads_count = 0;
JNIEXPORT void JNICALL
@ -51,9 +51,9 @@ Java_SuspendWithCurrentThread_registerTestedThreads(JNIEnv *jni, jclass cls, job
/* This function is executed on the suspender thread which is not Main thread */
JNIEXPORT void JNICALL
Java_ThreadToSuspend_suspendTestedThreads(JNIEnv *jni, jclass cls) {
jvmtiError* results = NULL;
jvmtiError* results = nullptr;
jvmtiError err;
const char* tname = get_thread_name(jvmti, jni, NULL); // current thread name
const char* tname = get_thread_name(jvmti, jni, nullptr); // current thread name
LOG("\nsuspendTestedThreads: started by thread: %s\n", tname);
err = jvmti->Allocate((threads_count * sizeof(jvmtiError)),
@ -105,7 +105,7 @@ Java_SuspendWithCurrentThread_checkTestedThreadsSuspended(JNIEnv *jni, jclass cl
JNIEXPORT void JNICALL
Java_SuspendWithCurrentThread_resumeTestedThreads(JNIEnv *jni, jclass cls) {
jvmtiError* results = NULL;
jvmtiError* results = nullptr;
jvmtiError err;
LOG("\nresumeTestedThreads: started\n");
@ -135,7 +135,7 @@ Java_SuspendWithCurrentThread_releaseTestedThreadsInfo(JNIEnv *jni, jclass cls)
LOG("\nreleaseTestedThreadsInfo: started\n");
for (int i = 0; i < threads_count; i++) {
if (threads[i] != NULL) {
if (threads[i] != nullptr) {
jni->DeleteGlobalRef(threads[i]);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
#define LOG(...) \
do { \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jvmtiEnv* jvmti = nullptr;
#define LOG(...) \
do { \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,8 +26,8 @@
extern "C" {
static jvmtiEnv* jvmti = NULL;
static jrawMonitorID threadLock = NULL;
static jvmtiEnv* jvmti = nullptr;
static jrawMonitorID threadLock = nullptr;
static char threadLockName[] = "threadLock";
#define LOG(...) \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,8 +35,8 @@ VMObjectAlloc(jvmtiEnv *jvmti,
jobject object,
jclass cls,
jlong size) {
char *signature = NULL;
jvmtiError err = jvmti->GetClassSignature(cls, &signature, NULL);
char *signature = nullptr;
jvmtiError err = jvmti->GetClassSignature(cls, &signature, nullptr);
if (err != JVMTI_ERROR_NONE) {
jni->FatalError("Failed during the GetClassSignature call");
}
@ -80,7 +80,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ static const char *THREAD_NAME = "breakpoint01Thr";
static volatile int bpEvents[METH_NUM];
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static volatile int callbacksEnabled = JNI_TRUE;
@ -92,7 +92,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) {
jni->FatalError("failed to obtain a class signature\n");
}
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) {
LOG("ClassLoad event received for the class %s setting breakpoints ...\n", sig);
setBP(jvmti, jni, klass);
}
@ -116,10 +116,10 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
return;
}
const char* thr_name = thr_info.name == NULL ? "NULL" : thr_info.name;
const char* thr_name = thr_info.name == nullptr ? "null" : thr_info.name;
const char* thr_virtual_tag = jni->IsVirtualThread(thread) == JNI_TRUE ? "virtual" : "platform";
const char* thr_daemon_tag = thr_info.is_daemon == JNI_TRUE ? "deamon" : "user";
if (thr_info.name == NULL || strcmp(thr_info.name, THREAD_NAME) != 0) {
if (thr_info.name == nullptr || strcmp(thr_info.name, THREAD_NAME) != 0) {
result = checkStatus = STATUS_FAILED;
LOG("TEST FAILED: Breakpoint event with unexpected thread info:\n");
LOG("\tname: \"%s\"\ttype: %s %s thread\n\n", thr_name, thr_virtual_tag, thr_daemon_tag);
@ -148,14 +148,14 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
LOG("TEST FAILED: unable to obtain a class signature during Breakpoint callback\n\n");
return;
}
if (clsSig == NULL || strcmp(clsSig, CLASS_SIG) != 0) {
if (clsSig == nullptr || strcmp(clsSig, CLASS_SIG) != 0) {
result = checkStatus = STATUS_FAILED;
LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == NULL) ? "NULL" : clsSig);
LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == nullptr) ? "null" : clsSig);
} else {
LOG("CHECK PASSED: class signature: \"%s\"\n", clsSig);
}
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = checkStatus = STATUS_FAILED;
LOG("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
@ -230,7 +230,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -268,22 +268,22 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr);
if (err != JVMTI_ERROR_NONE)
return JNI_ERR;
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE)
return JNI_ERR;
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
if (err != JVMTI_ERROR_NONE)
return JNI_ERR;
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
if (err != JVMTI_ERROR_NONE)
return JNI_ERR;
LOG("enabling the events done\n\n");
agent_lock = create_raw_monitor(jvmti, "agent_lock");
if (agent_lock == NULL)
if (agent_lock == nullptr)
return JNI_ERR;
return JNI_OK;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -75,7 +75,7 @@ static volatile int clsEvents[EXP_SIG_NUM];
static volatile int primClsEvents[UNEXP_SIG_NUM];
static jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID counter_lock;
@ -91,7 +91,7 @@ static void initCounters() {
static int findSig(char *sig, int expected) {
for (unsigned int i = 0; i < ((expected == 1) ? EXP_SIG_NUM : UNEXP_SIG_NUM); i++) {
if (sig != NULL &&
if (sig != nullptr &&
strcmp(((expected == 1) ? expSigs[i] : unexpSigs[i]), sig) == 0) {
return i; /* the signature found, return index */
}
@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -197,7 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
LOG("setting event callbacks done\nenabling ClassLoad event ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Error in SetEventNotificationMode: %d\n", err);
return JNI_ERR;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ typedef struct {
jint icount;
} class_info;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static size_t eventsCount = 0;
@ -158,7 +158,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls)
LOG(">>> %d methods:", inf.mcount);
for (int i = 0; i < inf.mcount; i++) {
if (i > 0) LOG(",");
if (methods[i] == NULL) {
if (methods[i] == nullptr) {
LOG(" null");
} else {
err = jvmti->GetMethodName(methods[i], &name, &sig, &generic);
@ -173,7 +173,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls)
LOG(">>> %d fields:", inf.fcount);
for (int i = 0; i < inf.fcount; i++) {
if (i > 0) LOG(",");
if (fields[i] == NULL) {
if (fields[i] == nullptr) {
LOG(" null");
} else {
err = jvmti->GetFieldName(cls, fields[i], &name, &sig, &generic);
@ -188,7 +188,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls)
LOG(">>> %d interfaces:", inf.icount);
for (int i = 0; i < inf.icount; i++) {
if (i > 0) LOG(",");
if (interfaces[i] == NULL) {
if (interfaces[i] == nullptr) {
LOG(" null");
} else {
err = jvmti->GetClassSignature(interfaces[i], &sig, &generic);
@ -226,7 +226,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls)
return;
}
if (inf.sig == NULL || strcmp(inf.sig, classes[eventsCount].sig) != 0) {
if (inf.sig == nullptr || strcmp(inf.sig, classes[eventsCount].sig) != 0) {
LOG("(#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, inf.sig);
LOG(", expected: \"%s\"\n", classes[eventsCount].sig);
result = STATUS_FAILED;
@ -262,7 +262,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -299,7 +299,7 @@ JNIEXPORT void JNICALL
Java_classprep01_getReady(JNIEnv *jni, jclass cls, jthread thread) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return;
}
@ -327,7 +327,7 @@ JNIEXPORT jint JNICALL
Java_classprep01_check(JNIEnv *jni, jclass cls, jthread thread) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ typedef struct {
jlocation c_loc;
} exceptionInfo;
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static exceptionInfo exs[] = {
@ -139,13 +139,13 @@ Exception(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr,
bool found = false;
for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) {
if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0
&& ex.t_cls != NULL && strcmp(ex.t_cls, exs[i].t_cls) == 0
&& ex.t_name != NULL && strcmp(ex.t_name, exs[i].t_name) == 0
&& ex.t_sig != NULL && strcmp(ex.t_sig, exs[i].t_sig) == 0
&& ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0
&& ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0
&& ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0
if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0
&& ex.t_cls != nullptr && strcmp(ex.t_cls, exs[i].t_cls) == 0
&& ex.t_name != nullptr && strcmp(ex.t_name, exs[i].t_name) == 0
&& ex.t_sig != nullptr && strcmp(ex.t_sig, exs[i].t_sig) == 0
&& ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0
&& ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0
&& ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0
&& ex.t_loc == exs[i].t_loc && ex.c_loc == exs[i].c_loc) {
jboolean isVirtual = jni->IsVirtualThread(thr);
if (isVirtualExpected != isVirtual) {
@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiCapabilities caps;
res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -217,27 +217,27 @@ Java_exception01_check(JNIEnv *jni, jclass cls) {
jclass clz;
jmethodID mid;
if (jvmti_env == NULL) {
if (jvmti_env == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("exception01c");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find exception01c class!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("exception01b");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find exception01b class!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("exception01a");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find exception01a class!\n");
return STATUS_FAILED;
}
mid = jni->GetStaticMethodID(clz, "run", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot find method run!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,7 +48,7 @@ typedef struct {
jlocation c_loc;
} exceptionInfo;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
@ -107,10 +107,10 @@ ExceptionCatch(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jloc
bool found = false;
for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) {
if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0
&& ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0
&& ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0
&& ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0
if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0
&& ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0
&& ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0
&& ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0
&& ex.c_loc == exs[i].c_loc) {
jboolean isVirtual = jni->IsVirtualThread(thr);
if (isVirtualExpected != isVirtual) {
@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -180,28 +180,28 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) {
jmethodID mid;
jthread thread;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("excatch01c");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find excatch01c class!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("excatch01b");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find excatch01b class!\n");
return STATUS_FAILED;
}
clz = jni->FindClass("excatch01a");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find excatch01a class!\n");
return STATUS_FAILED;
}
mid = jni->GetStaticMethodID(clz, "run", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot find method run!\n");
return STATUS_FAILED;
}
@ -213,7 +213,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) {
return STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = sizeof(exs)/sizeof(exceptionInfo);
} else {
@ -224,7 +224,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) {
eventsCount = 0;
isVirtualExpected = jni->IsVirtualThread(thread);
jni->CallStaticVoidMethod(clz, mid);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_EXCEPTION_CATCH: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,45 +65,45 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static volatile int eventsExpected = 0;
static volatile int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldacc01a;", "run", "()I", 2,
{ nullptr, "Lfieldacc01a;", "run", "()I", 2,
"Lfieldacc01a;", "staticBoolean", "Z", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 6,
{ nullptr, "Lfieldacc01a;", "run", "()I", 6,
"Lfieldacc01a;", "instanceBoolean", "Z", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 15,
{ nullptr, "Lfieldacc01a;", "run", "()I", 15,
"Lfieldacc01a;", "staticByte", "B", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 19,
{ nullptr, "Lfieldacc01a;", "run", "()I", 19,
"Lfieldacc01a;", "instanceByte", "B", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 28,
{ nullptr, "Lfieldacc01a;", "run", "()I", 28,
"Lfieldacc01a;", "staticShort", "S", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 32,
{ nullptr, "Lfieldacc01a;", "run", "()I", 32,
"Lfieldacc01a;", "instanceShort", "S", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 41,
{ nullptr, "Lfieldacc01a;", "run", "()I", 41,
"Lfieldacc01a;", "staticInt", "I", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 45,
{ nullptr, "Lfieldacc01a;", "run", "()I", 45,
"Lfieldacc01a;", "instanceInt", "I", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 54,
{ nullptr, "Lfieldacc01a;", "run", "()I", 54,
"Lfieldacc01a;", "staticLong", "J", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 58,
{ nullptr, "Lfieldacc01a;", "run", "()I", 58,
"Lfieldacc01a;", "instanceLong", "J", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 68,
{ nullptr, "Lfieldacc01a;", "run", "()I", 68,
"Lfieldacc01a;", "staticFloat", "F", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 72,
{ nullptr, "Lfieldacc01a;", "run", "()I", 72,
"Lfieldacc01a;", "instanceFloat", "F", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 82,
{ nullptr, "Lfieldacc01a;", "run", "()I", 82,
"Lfieldacc01a;", "staticDouble", "D", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 86,
{ nullptr, "Lfieldacc01a;", "run", "()I", 86,
"Lfieldacc01a;", "instanceDouble", "D", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 96,
{ nullptr, "Lfieldacc01a;", "run", "()I", 96,
"Lfieldacc01a;", "staticChar", "C", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 100,
{ nullptr, "Lfieldacc01a;", "run", "()I", 100,
"Lfieldacc01a;", "instanceChar", "C", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 109,
{ nullptr, "Lfieldacc01a;", "run", "()I", 109,
"Lfieldacc01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 113,
{ nullptr, "Lfieldacc01a;", "run", "()I", 113,
"Lfieldacc01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE },
{ NULL, "Lfieldacc01a;", "run", "()I", 122,
{ nullptr, "Lfieldacc01a;", "run", "()I", 122,
"Lfieldacc01a;", "staticArrInt", "[I", JNI_TRUE },
{ NULL, "Lfieldacc01a;", "run", "()I", 128,
{ nullptr, "Lfieldacc01a;", "run", "()I", 128,
"Lfieldacc01a;", "instanceArrInt", "[I", JNI_FALSE }
};
@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err);
@ -163,16 +163,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -182,12 +182,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -216,7 +216,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -245,7 +245,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -267,7 +267,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) {
LOG(">>> setting field access watches ...\n");
cls = jni->FindClass("fieldacc01a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldacc01a class!\n");
result = STATUS_FAILED;
return;
@ -289,7 +289,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) {
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot find field \"%s\"!\n", watches[i].f_name);
result = STATUS_FAILED;
return;
@ -317,7 +317,7 @@ Java_fieldacc01_check(JNIEnv *jni, jclass klass) {
}
cls = jni->FindClass("fieldacc01a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldacc01a class!\n");
result = STATUS_FAILED;
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,46 +65,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static int eventsExpected = 0;
static int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticBoolean", "Z", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticByte", "B", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticShort", "S", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticInt", "I", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticLong", "J", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticFloat", "F", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticDouble", "D", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticChar", "C", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "staticArrInt", "[I", JNI_TRUE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceBoolean", "Z", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceByte", "B", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceShort", "S", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceInt", "I", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceLong", "J", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceFloat", "F", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceDouble", "D", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceChar", "C", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE },
{ NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldacc02a;", "instanceArrInt", "[I", JNI_FALSE }
};
@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err);
@ -162,16 +162,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -181,12 +181,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -243,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n",
TranslateError(err), err);
@ -264,7 +264,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) {
LOG(">>> setting field access watches ...\n");
cls = jni->FindClass("fieldacc02a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldacc02a class!\n");
result = STATUS_FAILED;
return;
@ -287,7 +287,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) {
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot find field \"%s\"!\n", watches[i].f_name);
result = STATUS_FAILED;
return;
@ -313,7 +313,7 @@ Java_fieldacc02_check(JNIEnv *jni, jclass clz, jobject obj) {
LOG(">>> accessing fields ...\n");
cls = jni->FindClass("fieldacc02a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldacc02a class!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,25 +65,25 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static int eventsExpected = 0;
static int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldacc03a;", "run", "()I", 3,
{ nullptr, "Lfieldacc03a;", "run", "()I", 3,
"Lfieldacc03a;", "extendsBoolean", "Z", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 14,
{ nullptr, "Lfieldacc03a;", "run", "()I", 14,
"Lfieldacc03a;", "extendsByte", "B", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 25,
{ nullptr, "Lfieldacc03a;", "run", "()I", 25,
"Lfieldacc03a;", "extendsShort", "S", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 36,
{ nullptr, "Lfieldacc03a;", "run", "()I", 36,
"Lfieldacc03a;", "extendsInt", "I", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 47,
{ nullptr, "Lfieldacc03a;", "run", "()I", 47,
"Lfieldacc03a;", "extendsLong", "J", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 61,
{ nullptr, "Lfieldacc03a;", "run", "()I", 61,
"Lfieldacc03a;", "extendsFloat", "F", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 74,
{ nullptr, "Lfieldacc03a;", "run", "()I", 74,
"Lfieldacc03a;", "extendsDouble", "D", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 88,
{ nullptr, "Lfieldacc03a;", "run", "()I", 88,
"Lfieldacc03a;", "extendsChar", "C", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 100,
{ nullptr, "Lfieldacc03a;", "run", "()I", 100,
"Lfieldacc03a;", "extendsObject", "Ljava/lang/Object;", JNI_FALSE },
{ NULL, "Lfieldacc03a;", "run", "()I", 111,
{ nullptr, "Lfieldacc03a;", "run", "()I", 111,
"Lfieldacc03a;", "extendsArrInt", "[I", JNI_FALSE }
};
@ -100,7 +100,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err);
@ -142,16 +142,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -161,12 +161,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -256,7 +256,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) {
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
cls = jni->FindClass(watches[i].f_cls);
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find %s class!\n", watches[i].f_cls);
result = STATUS_FAILED;
return;
@ -266,7 +266,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) {
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig);
result = STATUS_FAILED;
return;
@ -291,7 +291,7 @@ Java_fieldacc03_check(JNIEnv *jni, jclass clz) {
}
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
jclass cls = jni->FindClass(watches[i].f_cls);
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find %s class!\n", watches[i].f_cls);
result = STATUS_FAILED;
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,10 +65,10 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static int eventsExpected = 0;
static int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldacc04a;", "run", "()I", 2,
{ nullptr, "Lfieldacc04a;", "run", "()I", 2,
"Lfieldacc04a;", "interfaceObject",
"Ljava/lang/Object;", JNI_TRUE },
{ NULL, "Lfieldacc04a;", "run", "()I", 12,
{ nullptr, "Lfieldacc04a;", "run", "()I", 12,
"Lfieldacc04a;", "interfaceArrInt",
"[I", JNI_TRUE }
};
@ -87,7 +87,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err);
@ -129,16 +129,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -148,12 +148,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -181,7 +181,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -210,7 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -243,7 +243,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) {
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
cls = jni->FindClass(watches[i].f_cls);
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find %s class!\n", watches[i].f_cls);
result = STATUS_FAILED;
return;
@ -253,7 +253,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) {
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig);
result = STATUS_FAILED;
return;
@ -279,7 +279,7 @@ Java_fieldacc04_check(JNIEnv *jni, jclass clz) {
}
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
jclass cls = jni->FindClass(watches[i].f_cls);
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find %s class!\n", watches[i].f_cls);
result = STATUS_FAILED;
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static int eventsExpected = 0;
static int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldmod01a;", "run", "()V", 1,
{ nullptr, "Lfieldmod01a;", "run", "()V", 1,
"Lfieldmod01a;", "staticBoolean", "Z", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 5,
{ nullptr, "Lfieldmod01a;", "run", "()V", 5,
"Lfieldmod01a;", "staticByte", "B", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 9,
{ nullptr, "Lfieldmod01a;", "run", "()V", 9,
"Lfieldmod01a;", "staticShort", "S", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 13,
{ nullptr, "Lfieldmod01a;", "run", "()V", 13,
"Lfieldmod01a;", "staticInt", "I", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 19,
{ nullptr, "Lfieldmod01a;", "run", "()V", 19,
"Lfieldmod01a;", "staticLong", "J", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 24,
{ nullptr, "Lfieldmod01a;", "run", "()V", 24,
"Lfieldmod01a;", "staticFloat", "F", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 30,
{ nullptr, "Lfieldmod01a;", "run", "()V", 30,
"Lfieldmod01a;", "staticDouble", "D", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 35,
{ nullptr, "Lfieldmod01a;", "run", "()V", 35,
"Lfieldmod01a;", "staticChar", "C", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 41,
{ nullptr, "Lfieldmod01a;", "run", "()V", 41,
"Lfieldmod01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 47,
{ nullptr, "Lfieldmod01a;", "run", "()V", 47,
"Lfieldmod01a;", "staticArrInt", "[I", JNI_TRUE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 52,
{ nullptr, "Lfieldmod01a;", "run", "()V", 52,
"Lfieldmod01a;", "instanceBoolean", "Z", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 58,
{ nullptr, "Lfieldmod01a;", "run", "()V", 58,
"Lfieldmod01a;", "instanceByte", "B", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 64,
{ nullptr, "Lfieldmod01a;", "run", "()V", 64,
"Lfieldmod01a;", "instanceShort", "S", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 70,
{ nullptr, "Lfieldmod01a;", "run", "()V", 70,
"Lfieldmod01a;", "instanceInt", "I", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 77,
{ nullptr, "Lfieldmod01a;", "run", "()V", 77,
"Lfieldmod01a;", "instanceLong", "J", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 83,
{ nullptr, "Lfieldmod01a;", "run", "()V", 83,
"Lfieldmod01a;", "instanceFloat", "F", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 90,
{ nullptr, "Lfieldmod01a;", "run", "()V", 90,
"Lfieldmod01a;", "instanceDouble", "D", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 96,
{ nullptr, "Lfieldmod01a;", "run", "()V", 96,
"Lfieldmod01a;", "instanceChar", "C", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 103,
{ nullptr, "Lfieldmod01a;", "run", "()V", 103,
"Lfieldmod01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} },
{ NULL, "Lfieldmod01a;", "run", "()V", 110,
{ nullptr, "Lfieldmod01a;", "run", "()V", 110,
"Lfieldmod01a;", "instanceArrInt", "[I", JNI_FALSE, {} }
};
@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.val = new_value;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err);
@ -231,16 +231,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -250,12 +250,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -353,7 +353,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2,
LOG(">>> setting field modification watches ...\n");
cls = jni->FindClass("fieldmod01a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldmod01a class!\n");
result = STATUS_FAILED;
return;
@ -364,7 +364,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2,
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig);
result = STATUS_FAILED;
return;
@ -412,7 +412,7 @@ Java_fieldmod01_check(JNIEnv *jni, jclass clz) {
}
jclass cls = jni->FindClass("fieldmod01a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldmod01a class!\n");
result = STATUS_FAILED;
return result;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE;
static int eventsExpected = 0;
static int eventsCount = 0;
static watch_info watches[] = {
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticBoolean", "Z", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticByte", "B", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticShort", "S", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticInt", "I", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticLong", "J", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticFloat", "F", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticDouble", "D", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticChar", "C", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "staticArrInt", "[I", JNI_TRUE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceBoolean", "Z", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceByte", "B", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceShort", "S", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceInt", "I", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceLong", "J", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceFloat", "F", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceDouble", "D", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceChar", "C", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} },
{ NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
{ nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0,
"Lfieldmod02a;", "instanceArrInt", "[I", JNI_FALSE, {} }
};
@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
watch.fid = field;
watch.loc = location;
watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE;
watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE;
watch.val = new_value;
err = jvmti->GetMethodDeclaringClass(method, &cls);
if (err != JVMTI_ERROR_NONE) {
@ -232,16 +232,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
if (watch.fid == watches[i].fid) {
if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) {
LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls);
result = STATUS_FAILED;
}
if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) {
if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name);
LOG(", expected: \"%s\"\n", watches[i].m_name);
result = STATUS_FAILED;
}
if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig);
LOG(", expected: \"%s\"\n", watches[i].m_sig);
result = STATUS_FAILED;
@ -251,12 +251,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc);
result = STATUS_FAILED;
}
if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) {
if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name);
LOG(", expected: \"%s\"\n", watches[i].f_name);
result = STATUS_FAILED;
}
if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) {
LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig);
LOG(", expected: \"%s\"\n", watches[i].f_sig);
result = STATUS_FAILED;
@ -292,7 +292,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -356,7 +356,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) {
LOG(">>> setting field modification watches ...\n");
cls = jni->FindClass("fieldmod02a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldmod02a class!\n");
result = STATUS_FAILED;
return;
@ -367,7 +367,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) {
} else {
watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
}
if (watches[i].fid == NULL) {
if (watches[i].fid == nullptr) {
LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig);
result = STATUS_FAILED;
return;
@ -422,7 +422,7 @@ Java_fieldmod02_check(JNIEnv *jni, jclass clz, jobject obj) {
cls = jni->FindClass("fieldmod02a");
if (cls == NULL) {
if (cls == nullptr) {
LOG("Cannot find fieldmod02a class!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,7 @@ typedef struct {
jlocation loc;
} pop_info;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static volatile jboolean isVirtualExpected = JNI_FALSE;
@ -111,17 +111,17 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodI
LOG(">>> ... done\n");
if (eventsCount < sizeof(pops)/sizeof(pop_info)) {
if (cls_sig == NULL || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) {
if (cls_sig == nullptr || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) {
LOG("(pop#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig);
LOG(", expected: \"%s\"\n", pops[eventsCount].cls_sig);
result = STATUS_FAILED;
}
if (name == NULL || strcmp(name, pops[eventsCount].name) != 0) {
if (name == nullptr || strcmp(name, pops[eventsCount].name) != 0) {
LOG("(pop#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name);
LOG(", expected: \"%s\"\n", pops[eventsCount].name);
result = STATUS_FAILED;
}
if (sig == NULL || strcmp(sig, pops[eventsCount].sig) != 0) {
if (sig == nullptr || strcmp(sig, pops[eventsCount].sig) != 0) {
LOG("(pop#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig);
LOG(", expected: \"%s\"\n", pops[eventsCount].sig);
result = STATUS_FAILED;
@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -203,7 +203,7 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) {
return STATUS_FAILED;
}
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -218,19 +218,19 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) {
LOG("Failed to SetBreakpoint: %s (%d)\n", TranslateError(err), err);
return STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable JVMTI_EVENT_FRAME_POP event: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
}
clz = jni->FindClass("framepop01a");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find framepop01a class!\n");
result = STATUS_FAILED;
return STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ typedef struct thr {
item_t tos;
} thr;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID event_lock;
static jboolean printdump = JNI_TRUE;
@ -116,7 +116,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth)
fatal(jni, "Unknown thread:\n");
}
if (threads[i].tos == NULL) {
if (threads[i].tos == nullptr) {
watch_events = JNI_FALSE;
printInfo(jni, jvmti, thr, method, depth);
fatal(jni, "Stack underflow:\n");
@ -131,7 +131,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth)
return;
}
free(old);
} while (threads[i].tos != NULL);
} while (threads[i].tos != nullptr);
watch_events = JNI_FALSE;
printInfo(jni, jvmti, thr, method, depth);
@ -155,11 +155,11 @@ void push(JNIEnv *jni, jthread thr, jmethodID method, int depth) {
fatal(jni, "Out of threads\n");
}
threads[i].thread = jni->NewGlobalRef(thr);
threads[i].tos = NULL;
threads[i].tos = nullptr;
}
new_item = (item_t)malloc(sizeof(item));
if (new_item == NULL) {
if (new_item == nullptr) {
fatal(jni, "Out of memory\n");
}
@ -246,7 +246,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -280,11 +280,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
LOG("(SetEventCallbacks) unexpected error: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
@ -295,18 +295,18 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
JNIEXPORT void JNICALL Java_framepop02_getReady(JNIEnv *jni, jclass cls) {
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL),
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr),
"Error in SetEventNotificationMode");
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL),
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr),
"Error in SetEventNotificationMode");
watch_events = JNI_TRUE;
}
JNIEXPORT void JNICALL Java_framepop02_check(JNIEnv *jni, jclass cls) {
watch_events = JNI_FALSE;
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL),
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr),
"Error in SetEventNotificationMode");
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL),
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr),
"Error in SetEventNotificationMode");
if (printdump == JNI_TRUE) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -45,7 +45,7 @@ typedef struct {
const jlocation loc;
} entry_info;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
@ -78,7 +78,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth
result = STATUS_FAILED;
return;
}
if (cls_sig != NULL && strcmp(cls_sig, "Lmentry01;") == 0) {
if (cls_sig != nullptr && strcmp(cls_sig, "Lmentry01;") == 0) {
LOG(">>> retrieving method entry info ...\n");
err = jvmti->GetMethodName(method, &entry.name, &entry.sig, &generic);
@ -100,12 +100,12 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth
LOG(">>> ... done\n");
if (eventsCount < sizeof(entries)/sizeof(entry_info)) {
if (entry.name == NULL || strcmp(entry.name, entries[eventsCount].name) != 0) {
if (entry.name == nullptr || strcmp(entry.name, entries[eventsCount].name) != 0) {
LOG("(entry#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, entry.name);
LOG(", expected: \"%s\"\n", entries[eventsCount].name);
result = STATUS_FAILED;
}
if (entry.sig == NULL || strcmp(entry.sig, entries[eventsCount].sig) != 0) {
if (entry.sig == nullptr || strcmp(entry.sig, entries[eventsCount].sig) != 0) {
LOG("(entry#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, entry.sig);
LOG(", expected: \"%s\"\n", entries[eventsCount].sig);
result = STATUS_FAILED;
@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -176,7 +176,7 @@ JNIEXPORT void JNICALL
Java_mentry01_enable(JNIEnv *jni, jclass cls) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
return;
}
@ -188,7 +188,7 @@ Java_mentry01_enable(JNIEnv *jni, jclass cls) {
}
isVirtualExpected = jni->IsVirtualThread(thread);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = sizeof(entries)/sizeof(entry_info);
eventsCount = 0;
@ -202,7 +202,7 @@ JNIEXPORT jint JNICALL
Java_mentry01_check(JNIEnv *jni, jclass cls) {
jmethodID mid = jni->GetStaticMethodID(cls, "dummy", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot find metod \"dummy()\"!\n");
return STATUS_FAILED;
}
@ -219,13 +219,13 @@ JNIEXPORT void JNICALL
Java_mentry01_chain(JNIEnv *jni, jclass cls) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
result = STATUS_FAILED;
return;
}
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_METHOD_ENTRY event: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static jboolean isVirtualExpected = JNI_FALSE;
@ -40,7 +40,7 @@ static int MethodEntriesExpected = 0;
static int MethodExitsExpected = 0;
static int MethodEntriesCount = 0;
static int MethodExitsCount = 0;
static jmethodID mid = NULL;
static jmethodID mid = nullptr;
void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni,
jthread thread_obj, jmethodID method) {
@ -75,7 +75,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -116,7 +116,7 @@ JNIEXPORT void JNICALL
Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return;
}
@ -130,13 +130,13 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) {
isVirtualExpected = jni->IsVirtualThread(thread);
mid = jni->GetStaticMethodID(cls, "emptyMethod", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot find Method ID for emptyMethod\n");
result = STATUS_FAILED;
return;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr);
if (err == JVMTI_ERROR_NONE) {
MethodEntriesCount = 0;
MethodEntriesExpected = i;
@ -145,7 +145,7 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) {
result = STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr);
if (err == JVMTI_ERROR_NONE) {
MethodExitsCount = 0;
MethodExitsExpected = i;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,7 @@ typedef struct {
jlocation loc;
} method_location_info;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static jboolean isVirtualExpected = JNI_FALSE;
@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni,
result = STATUS_FAILED;
return;
}
if (cls_sig != NULL && strcmp(cls_sig, "Lmexit01a;") == 0) {
if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit01a;") == 0) {
LOG(">>> retrieving method exit info ...\n");
err = jvmti->GetMethodName(method, &name, &sig, &generic);
@ -95,17 +95,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni,
LOG(">>> ... done\n");
if (eventsCount < sizeof(exits) / sizeof(method_location_info)) {
if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) {
if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) {
LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig);
LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig);
result = STATUS_FAILED;
}
if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) {
if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) {
LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name);
LOG(", expected: \"%s\"\n", exits[eventsCount].name);
result = STATUS_FAILED;
}
if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) {
if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) {
LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig);
LOG(", expected: \"%s\"\n", exits[eventsCount].sig);
result = STATUS_FAILED;
@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -177,12 +177,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT jint JNICALL
Java_mexit01_init0(JNIEnv *jni, jclass cls) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = sizeof(exits)/sizeof(method_location_info);
eventsCount = 0;
@ -200,7 +200,7 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) {
jclass clz;
jmethodID mid;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -214,20 +214,20 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) {
isVirtualExpected = jni->IsVirtualThread(thread);
clz = jni->FindClass("mexit01a");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Cannot find MethodExit.mexit01a class!\n");
return STATUS_FAILED;
}
mid = jni->GetStaticMethodID(clz, "dummy", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot find metod \"dummy()\"!\n");
return STATUS_FAILED;
}
jni->CallStaticVoidMethod(clz, mid);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -40,7 +40,7 @@ typedef struct {
jlocation loc;
} method_location_info;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static jboolean isVirtualExpected = JNI_FALSE;
@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni,
result = STATUS_FAILED;
return;
}
if (cls_sig != NULL && strcmp(cls_sig, "Lmexit02a;") == 0) {
if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit02a;") == 0) {
LOG(">>> retrieving method exit info ...\n");
err = jvmti->GetMethodName(method, &name, &sig, &generic);
@ -100,17 +100,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni,
}
if (eventsCount < sizeof(exits)/sizeof(method_location_info)) {
if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) {
if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) {
LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig);
LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig);
result = STATUS_FAILED;
}
if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) {
if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) {
LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name);
LOG(", expected: \"%s\"\n", exits[eventsCount].name);
result = STATUS_FAILED;
}
if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) {
if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) {
LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig);
LOG(", expected: \"%s\"\n", exits[eventsCount].sig);
result = STATUS_FAILED;
@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -178,7 +178,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) {
jclass clz;
jmethodID mid;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -192,18 +192,18 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) {
isVirtualExpected = jni->IsVirtualThread(thread);
clz = jni->FindClass("mexit02a");
if (clz == NULL) {
if (clz == nullptr) {
LOG("Failed to find class \"mexit02a\"!\n");
return STATUS_FAILED;
}
mid = jni->GetStaticMethodID(clz, "dummy", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Failed to get method \"dummy\"!\n");
return STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = sizeof(exits)/sizeof(method_location_info);
eventsCount = 0;
@ -214,7 +214,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) {
jni->CallStaticVoidMethod(clz, mid);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,13 +35,13 @@ extern "C" {
/* ========================================================================== */
/* scaffold objects */
static JNIEnv *jni = NULL;
static jvmtiEnv *jvmti = NULL;
static JNIEnv *jni = nullptr;
static jvmtiEnv *jvmti = nullptr;
static jlong timeout = 0;
/* test objects */
static jthread expected_thread = NULL;
static jobject expected_object = NULL;
static jthread expected_thread = nullptr;
static jobject expected_object = nullptr;
static volatile int eventsCount = 0;
/* ========================================================================== */
@ -53,12 +53,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) {
print_thread_info(jvmti, jni, thr);
if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
if (expected_thread == nullptr) {
jni->FatalError("expected_thread is null.");
}
if (expected_object == NULL) {
jni->FatalError("expected_object is NULL.");
if (expected_object == nullptr) {
jni->FatalError("expected_object is null.");
}
/* check if event is for tested thread and for tested object */
@ -72,7 +72,7 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) {
/* ========================================================================== */
static int prepare() {
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr);
if (err != JVMTI_ERROR_NONE) {
jni->FatalError("Error enabling JVMTI_EVENT_MONITOR_CONTENDED_ENTER.");
}
@ -82,7 +82,7 @@ static int prepare() {
static int clean() {
LOG("Disabling events\n");
/* disable MonitorContendedEnter event */
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr);
if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status();
}
@ -139,7 +139,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
LOG("Timeout: %d msc\n", (int) timeout);
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}
@ -190,13 +190,13 @@ JNIEXPORT void JNICALL Java_mcontenter01_setExpected(JNIEnv *jni, jobject clz, j
LOG("Remembering global reference for monitor object is %p\n", obj);
/* make object accessible for a long time */
expected_object = jni->NewGlobalRef(obj);
if (expected_object == NULL) {
if (expected_object == nullptr) {
jni->FatalError("Error saving global reference to monitor.\n");
}
/* make thread accessable for a long time */
expected_thread = jni->NewGlobalRef(thread);
if (thread == NULL) {
if (thread == nullptr) {
jni->FatalError("Error saving global reference to thread.\n");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,13 +32,13 @@ extern "C" {
/* ========================================================================== */
/* scaffold objects */
static JNIEnv *jni = NULL;
static jvmtiEnv *jvmti = NULL;
static JNIEnv *jni = nullptr;
static jvmtiEnv *jvmti = nullptr;
static jlong timeout = 0;
/* test objects */
static jthread expected_thread = NULL;
static jobject expected_object = NULL;
static jthread expected_thread = nullptr;
static jobject expected_object = nullptr;
static volatile int eventsCount = 0;
@ -51,12 +51,12 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj)
print_thread_info(jvmti, jni, thr);
if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
if (expected_thread == nullptr) {
jni->FatalError("expected_thread is null.");
}
if (expected_object == NULL) {
jni->FatalError("expected_object is NULL.");
if (expected_object == nullptr) {
jni->FatalError("expected_object is null.");
}
/* check if event is for tested thread and for tested object */
@ -73,12 +73,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) {
LOG("MonitorContendedEnter event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object);
print_thread_info(jvmti, jni, thr);
if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
if (expected_thread == nullptr) {
jni->FatalError("expected_thread is null.");
}
if (expected_object == NULL) {
jni->FatalError("expected_object is NULL.");
if (expected_object == nullptr) {
jni->FatalError("expected_object is null.");
}
/* check if event is for tested thread and for tested object */
@ -97,14 +97,14 @@ static int prepare() {
LOG("Prepare: find tested thread\n");
/* enable MonitorContendedEntered event */
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n");
return JNI_FALSE;
}
/* enable MonitorContendedEnter event */
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n");
return JNI_FALSE;
@ -116,7 +116,7 @@ static int prepare() {
static int clean() {
jvmtiError err;
/* disable MonitorContendedEntered event */
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,nullptr);
if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status();
}
@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
LOG("Timeout: %d msc\n", (int) timeout);
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}
@ -227,13 +227,13 @@ JNIEXPORT void JNICALL Java_mcontentered01_setExpected(JNIEnv *jni, jobject clz,
LOG("Remembering global reference for monitor object is %p\n", obj);
/* make object accessible for a long time */
expected_object = jni->NewGlobalRef(obj);
if (expected_object == NULL) {
if (expected_object == nullptr) {
jni->FatalError("Error saving global reference to monitor.\n");
}
/* make thread accessable for a long time */
expected_thread = jni->NewGlobalRef(thread);
if (thread == NULL) {
if (thread == nullptr) {
jni->FatalError("Error saving global reference to thread.\n");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,13 +31,13 @@
extern "C" {
/* scaffold objects */
static JNIEnv *jni = NULL;
static jvmtiEnv *jvmti = NULL;
static JNIEnv *jni = nullptr;
static jvmtiEnv *jvmti = nullptr;
static jlong timeout = 0;
/* test objects */
static jthread expected_thread = NULL;
static jobject expected_object = NULL;
static jthread expected_thread = nullptr;
static jobject expected_object = nullptr;
static volatile int eventsCount = 0;
void JNICALL
@ -47,12 +47,12 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout)
print_thread_info(jvmti, jni, thr);
if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
if (expected_thread == nullptr) {
jni->FatalError("expected_thread is null.");
}
if (expected_object == NULL) {
jni->FatalError("expected_object is NULL.");
if (expected_object == nullptr) {
jni->FatalError("expected_object is null.");
}
/* check if event is for tested thread and for tested object */
@ -70,7 +70,7 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout)
static int prepare() {
/* enable MonitorWait event */
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n");
return JNI_FALSE;
@ -80,7 +80,7 @@ static int prepare() {
static int clean() {
/* disable MonitorWait event */
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status();
}
@ -135,7 +135,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
LOG("Timeout: %d msc\n", (int) timeout);
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}
@ -182,13 +182,13 @@ JNIEXPORT void JNICALL Java_monitorwait01_setExpected(JNIEnv *jni, jobject clz,
LOG("Remembering global reference for monitor object is %p\n", obj);
/* make object accessible for a long time */
expected_object = jni->NewGlobalRef(obj);
if (expected_object == NULL) {
if (expected_object == nullptr) {
jni->FatalError("Error saving global reference to monitor.\n");
}
/* make thread accessable for a long time */
expected_thread = jni->NewGlobalRef(thread);
if (thread == NULL) {
if (thread == nullptr) {
jni->FatalError("Error saving global reference to thread.\n");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,13 +31,13 @@
extern "C" {
/* scaffold objects */
static JNIEnv *jni = NULL;
static jvmtiEnv *jvmti = NULL;
static JNIEnv *jni = nullptr;
static jvmtiEnv *jvmti = nullptr;
static jlong timeout = 0;
/* test objects */
static jthread expected_thread = NULL;
static jobject expected_object = NULL;
static jthread expected_thread = nullptr;
static jobject expected_object = nullptr;
static volatile int eventsCount = 0;
void JNICALL
@ -48,12 +48,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t
print_thread_info(jvmti, jni, thr);
if (expected_thread == NULL) {
jni->FatalError("expected_thread is NULL.");
if (expected_thread == nullptr) {
jni->FatalError("expected_thread is null.");
}
if (expected_object == NULL) {
jni->FatalError("expected_object is NULL.");
if (expected_object == nullptr) {
jni->FatalError("expected_object is null.");
}
/* check if event is for tested thread and for tested object */
@ -71,7 +71,7 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t
static int prepare() {
/* enable MonitorWait event */
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Prepare: 11\n");
return JNI_FALSE;
@ -81,7 +81,7 @@ static int prepare() {
static int clean() {
/* disable MonitorWaited event */
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr);
if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status();
}
@ -136,7 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
LOG("Timeout: %d msc\n", (int) timeout);
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}
@ -185,13 +185,13 @@ JNIEXPORT void JNICALL Java_monitorwaited01_setExpected(JNIEnv *jni, jobject clz
LOG("Remembering global reference for monitor object is %p\n", obj);
/* make object accessible for a long time */
expected_object = jni->NewGlobalRef(obj);
if (expected_object == NULL) {
if (expected_object == nullptr) {
jni->FatalError("Error saving global reference to monitor.\n");
}
/* make thread accessable for a long time */
expected_thread = jni->NewGlobalRef(thread);
if (thread == NULL) {
if (thread == nullptr) {
jni->FatalError("Error saving global reference to thread.\n");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ static const char *CLASS_SIG =
"Lnativemethbind01$TestedClass;";
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID counter_lock;
@ -76,7 +76,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread,
return;
}
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
@ -118,7 +118,7 @@ anotherNativeMethod(JNIEnv *jni, jobject obj) {
/* dummy method used only to provoke NativeMethodBind event */
JNIEXPORT void JNICALL
Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNative) {
jclass testedCls = NULL;
jclass testedCls = nullptr;
JNINativeMethod meth;
LOG("Inside the nativeMethod()\n");
@ -126,7 +126,7 @@ Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNa
if (registerNative == JNI_TRUE) {
LOG("Finding class \"%s\" ...\n", CLASS_SIG);
testedCls = jni->FindClass(CLASS_SIG);
if (testedCls == NULL) {
if (testedCls == nullptr) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG);
return;
@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -203,7 +203,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr);
if (err != JVMTI_ERROR_NONE){
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,7 +36,7 @@ extern "C" {
static volatile int wrongBindEv = 0;
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID counter_lock;
@ -46,7 +46,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
jmethodID method, void *addr, void **new_addr) {
jvmtiPhase phase;
jvmtiError err;
char *methNam = NULL, *methSig = NULL;
char *methNam = nullptr, *methSig = nullptr;
RawMonitorLocker rml(jvmti, jni, counter_lock);
err = jvmti->GetPhase(&phase);
@ -60,7 +60,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
return;
}
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -70,7 +70,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
LOG("NativeMethodBind received for \"%s %s\"\n", methNam, methSig);
}
if (methNam != NULL) {
if (methNam != nullptr) {
err = jvmti->Deallocate((unsigned char *) methNam);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -78,7 +78,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread,
}
}
if (methSig != NULL) {
if (methSig != nullptr) {
err = jvmti->Deallocate((unsigned char *) methSig);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -116,7 +116,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -150,11 +150,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,7 +46,7 @@ static const char *CLASS_SIG =
"Lnativemethbind03$TestedClass;";
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID counter_lock;
@ -72,7 +72,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
return;
}
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
LOG("\tmethod: \"%s %s\"\n", methNam, methSig);
}
if (methNam != NULL) {
if (methNam != nullptr) {
err = jvmti->Deallocate((unsigned char *) methNam);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -92,7 +92,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
}
}
if (methSig != NULL) {
if (methSig != nullptr) {
err = jvmti->Deallocate((unsigned char *) methSig);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -133,13 +133,13 @@ nativeMethod(JNIEnv *jni, jobject obj) {
/* dummy method used only to provoke NativeMethodBind event */
JNIEXPORT void JNICALL
Java_nativemethbind03_registerNative(JNIEnv *jni, jobject obj) {
jclass testedCls = NULL;
jclass testedCls = nullptr;
JNINativeMethod meth;
LOG("Inside the registerNative()\n"
"Finding class \"%s\" ...\n", CLASS_SIG);
testedCls = jni->FindClass(CLASS_SIG);
if (testedCls == NULL) {
if (testedCls == nullptr) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG);
return;
@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -207,11 +207,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,7 @@ static volatile int origCalls = 0;
static volatile int redirCalls = 0;
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jrawMonitorID counter_lock;
@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
return;
}
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
@ -97,7 +97,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
*new_addr = (void *) redirNativeMethod;
}
if (methNam != NULL) {
if (methNam != nullptr) {
err = jvmti->Deallocate((unsigned char *) methNam);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -105,7 +105,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method,
}
}
if (methSig != NULL) {
if (methSig != nullptr) {
err = jvmti->Deallocate((unsigned char *) methSig);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -179,7 +179,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -50,7 +50,7 @@ static const char *CLASS_SIG =
"Lsinglestep01;";
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static volatile jboolean isVirtualExpected = JNI_FALSE;
@ -62,7 +62,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) {
jvmtiError err;
mid = jni->GetMethodID(klass, METHODS[0], METHOD_SIGS[0]);
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("failed to get ID for the java method\n");
}
@ -86,7 +86,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) {
if (err != JVMTI_ERROR_NONE) {
jni->FatalError("failed to obtain a class signature\n");
}
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) {
LOG("ClassLoad event received for the class \"%s\"\n"
"\tsetting breakpoint ...\n", sig);
setBP(jvmti, jni, klass);
@ -117,7 +117,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio
jni->FatalError("Breakpoint: failed to obtain a class signature\n");
}
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) {
LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr);
if (err != JVMTI_ERROR_NONE) {
@ -145,7 +145,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
print_thread_info(jvmti, jni, thread);
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n");
@ -166,7 +166,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
return;
}
if (sig != NULL) {
if (sig != nullptr) {
LOG("\tmethod name: \"%s\"\n"
"\tsignature: \"%s\"\n"
"\tmethod declaring class: \"%s\"\n",
@ -244,7 +244,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -284,19 +284,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,7 @@ extern "C" {
static volatile jint result = PASSED;
static volatile long wrongStepEv = 0;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
/** callback functions **/
void JNICALL
@ -78,7 +78,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -113,11 +113,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -53,7 +53,7 @@ static const char *CLASS_SIG =
"Lsinglestep03;";
static volatile jint result = PASSED;
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static volatile int callbacksEnabled = JNI_FALSE;
@ -64,7 +64,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) {
jvmtiError err;
mid = jni->GetMethodID(klass, METHODS[0][0], METHODS[0][1]);
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("failed to get ID for the java method\n");
}
@ -91,7 +91,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) {
jni->FatalError("failed to obtain a class signature\n");
}
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) {
LOG("ClassLoad event received for the class \"%s\"\n"
"\tsetting breakpoint ...\n", sig);
setBP(jvmti, jni, klass);
@ -133,7 +133,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio
jni->FatalError("Breakpoint: failed to obtain a class signature\n");
}
if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) {
LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr);
if (err != JVMTI_ERROR_NONE) {
@ -159,7 +159,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
LOG(">>>> SingleStep event received\n");
err = jvmti->GetMethodName(method, &methNam, &methSig, NULL);
err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr);
if (err != JVMTI_ERROR_NONE) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n");
@ -180,7 +180,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca
return;
}
if (sig != NULL) {
if (sig != nullptr) {
if (stepEv[METH_NUM - 1][0] == 1) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: SingleStep event received after disabling the event generation\n\n");
@ -272,7 +272,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -310,19 +310,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
LOG("setting event callbacks done\nenabling JVMTI events ...\n");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,12 +34,12 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static int eventsCount = 0;
static int eventsExpected = 0;
static const char *prefix = NULL;
static const char *prefix = nullptr;
void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
jvmtiError err;
@ -54,10 +54,10 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
print_thread_info(jvmti, jni, thread);
if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) {
if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) {
eventsCount++;
snprintf(name, sizeof(name), "%s%d", prefix, eventsCount);
if (inf.name == NULL || strcmp(name, inf.name) != 0) {
if (inf.name == nullptr || strcmp(name, inf.name) != 0) {
LOG("(#%d) wrong thread name: \"%s\"",eventsCount, inf.name);
LOG(", expected: \"%s\"\n", name);
result = STATUS_FAILED;
@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -89,19 +89,19 @@ JNIEXPORT void JNICALL
Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return;
}
prefix = jni->GetStringUTFChars(name, NULL);
if (prefix == NULL) {
prefix = jni->GetStringUTFChars(name, nullptr);
if (prefix == nullptr) {
LOG("Failed to copy UTF-8 string!\n");
result = STATUS_FAILED;
return;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = i;
} else {
@ -112,12 +112,12 @@ Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) {
JNIEXPORT jint JNICALL
Java_threadend01_check(JNIEnv *jni, jclass cls) {
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL);
jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@
extern "C" {
/* scaffold objects */
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jlong timeout = 0;
static int eventCount = 0;
@ -52,7 +52,7 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
LOG("disabling %s\n", TranslateEvent(event));
}
err = jvmti->SetEventNotificationMode(enable, event, NULL);
err = jvmti->SetEventNotificationMode(enable, event, nullptr);
if (err != JVMTI_ERROR_NONE) {
set_agent_fail_status();
return JNI_FALSE;
@ -129,7 +129,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
timeout = 60 * 1000;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -150,7 +150,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,12 +34,12 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static int eventsCount = 0;
static int eventsExpected = 0;
static const char *prefix = NULL;
static const char *prefix = nullptr;
void JNICALL
ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
@ -54,7 +54,7 @@ ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
LOG(">>> %s\n", inf.name);
if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) {
if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) {
snprintf(name, sizeof(name), "%s%d", prefix, eventsCount);
if (strcmp(name, inf.name) != 0) {
LOG("(#%d) wrong thread name: \"%s\"", eventsCount, inf.name);
@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -89,19 +89,19 @@ JNIEXPORT void JNICALL
Java_threadstart01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return;
}
prefix = jni->GetStringUTFChars(name, NULL);
if (prefix == NULL) {
prefix = jni->GetStringUTFChars(name, nullptr);
if (prefix == nullptr) {
LOG("Failed to copy UTF-8 string!\n");
result = STATUS_FAILED;
return;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
if (err == JVMTI_ERROR_NONE) {
eventsExpected = i;
} else {
@ -114,12 +114,12 @@ JNIEXPORT jint JNICALL
Java_threadstart01_check(JNIEnv *jni, jclass cls) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,16 +33,16 @@ extern "C" {
#define STATUS_FAILED 2
#define WAIT_TIME 20000
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
/* volatile variables */
static jrawMonitorID agent_start_lock, thr_start_lock, thr_resume_lock, thr_event_lock;
static volatile jthread agent_thread = NULL;
static volatile jthread agent_thread = nullptr;
static volatile jboolean terminate_debug_agent = JNI_FALSE;
static volatile jboolean debug_agent_timed_out = JNI_FALSE;
static volatile jboolean debug_agent_started = JNI_FALSE;
static volatile jthread next_thread = NULL;
static volatile jthread next_thread = nullptr;
static jvmtiThreadInfo inf;
static volatile int eventsCount = 0;
static volatile jint result = PASSED;
@ -128,12 +128,12 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) {
RawMonitorLocker thr_start_locker(jvmti, jni, thr_start_lock);
while (terminate_debug_agent != JNI_TRUE) {
if (next_thread == NULL) {
if (next_thread == nullptr) {
/* wait till new thread will be created and started */
thr_start_locker.wait();
}
if (next_thread != NULL) {
if (next_thread != nullptr) {
/* hmm, why NewGlobalRef is called one more time???
* next_thread = env->NewGlobalRef(next_thread);
*/
@ -160,7 +160,7 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) {
}
jni->DeleteGlobalRef(next_thread);
next_thread = NULL;
next_thread = nullptr;
/* Notify ThreadStart callback that thread has been resumed */
@ -267,38 +267,38 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
}
void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) {
jclass cls = NULL;
jmethodID mid = NULL;
jclass cls = nullptr;
jmethodID mid = nullptr;
LOG(">>> VMInit event: start\n");
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL),
check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr),
"Failed to enable JVMTI_EVENT_THREAD_START");
/* Start agent thread */
cls = jni->FindClass("java/lang/Thread");
if (cls == NULL) {
if (cls == nullptr) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: Cannot start agent thread: FindClass() failed\n");
return;
}
mid = jni->GetMethodID(cls, "<init>", "()V");
if (mid == NULL) {
if (mid == nullptr) {
result = STATUS_FAILED;
COMPLAIN("TEST FAILED: Cannot start agent thread: GetMethodID() failed\n");
return;
}
agent_thread = jni->NewObject(cls, mid);
if (agent_thread == NULL) {
if (agent_thread == nullptr) {
result = STATUS_FAILED;
COMPLAIN("Cannot start agent thread: NewObject() failed\n");
return;
}
agent_thread = (jthread) jni->NewGlobalRef(agent_thread);
if (agent_thread == NULL) {
if (agent_thread == nullptr) {
result = STATUS_FAILED;
COMPLAIN("Cannot create global reference for agent_thread\n");
return;
@ -311,7 +311,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) {
RawMonitorLocker agent_start_locker(jvmti, jni, agent_start_lock);
check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, NULL, JVMTI_THREAD_NORM_PRIORITY),
check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, nullptr, JVMTI_THREAD_NORM_PRIORITY),
"Failed to RunAgentThread");
agent_start_locker.wait();
LOG(">>> VMInit event: end\n");
@ -327,7 +327,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -366,14 +366,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,11 +35,11 @@ extern "C" {
#define STATUS_FAILED 2
#define WAIT_TIME 1000
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
static jrawMonitorID wait_lock;
static const char *threadName = NULL;
static const char *threadName = nullptr;
static int startsCount = 0;
static int startsExpected = 0;
static int endsCount = 0;
@ -57,7 +57,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
LOG(">>> start: %s\n", inf.name);
if (inf.name != NULL && strcmp(inf.name, threadName) == 0) {
if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) {
startsCount++;
}
}
@ -74,7 +74,7 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
LOG(">>> end: %s\n", inf.name);
if (inf.name != NULL && strcmp(inf.name, threadName) == 0) {
if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) {
endsCount++;
}
}
@ -84,7 +84,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -110,20 +110,20 @@ JNIEXPORT jint JNICALL
Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) {
jvmtiError err;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
threadName = jni->GetStringUTFChars(name, NULL);
if (threadName == NULL) {
threadName = jni->GetStringUTFChars(name, nullptr);
if (threadName == nullptr) {
LOG("Failed to copy UTF-8 string!\n");
return STATUS_FAILED;
}
wait_lock = create_raw_monitor(jvmti, "_wait_lock");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
if (err == JVMTI_ERROR_NONE) {
startsExpected = 1;
} else {
@ -131,7 +131,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) {
result = STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr);
if (err == JVMTI_ERROR_NONE) {
endsExpected = 1;
} else {
@ -143,7 +143,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) {
{
RawMonitorLocker wait_locker(jvmti, jni, wait_lock);
err = jvmti->RunAgentThread(thr, threadProc, NULL, JVMTI_THREAD_MAX_PRIORITY);
err = jvmti->RunAgentThread(thr, threadProc, nullptr, JVMTI_THREAD_MAX_PRIORITY);
if (err != JVMTI_ERROR_NONE) {
LOG("(RunAgentThread) unexpected error: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
@ -164,13 +164,13 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) {
}
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
}
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -65,10 +65,10 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, jcla
LOG("VMObjectAlloc: \"%s\", size=%ld\n", signature, (long)size);
if (signature != NULL)
if (signature != nullptr)
jvmti->Deallocate((unsigned char*)signature);
if (generic != NULL)
if (generic != nullptr)
jvmti->Deallocate((unsigned char*)generic);
}
@ -92,7 +92,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
}
jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv* jvmti = NULL;
jvmtiEnv* jvmti = nullptr;
jvmtiCapabilities caps;
jvmtiEventCallbacks callbacks;
jvmtiError err;
@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
/* create JVMTI environment */
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -127,12 +127,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
}
/* enable VMObjectAlloc event */
if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL) != JVMTI_ERROR_NONE) {
if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr) != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
/* register agent proc and arg */
set_agent_proc(agentProc, NULL);
set_agent_proc(agentProc, nullptr);
return JNI_OK;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,12 +28,12 @@
extern "C" {
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong test_passed of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -48,14 +48,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) {
jthread *threadsPtr;
jboolean test_passed = JNI_TRUE;
if (jvmti_env == NULL) {
if (jvmti_env == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return JNI_FALSE;
}
LOG(">>> (threadsCountPtr) null pointer check ...\n");
err = jvmti_env->GetAllThreads(NULL, &threadsPtr);
err = jvmti_env->GetAllThreads(nullptr, &threadsPtr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(threadsCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);
@ -64,14 +64,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) {
LOG(">>> (threadsPtr) null pointer check ...\n");
err = jvmti_env->GetAllThreads(&threadsCountPtr, NULL);
err = jvmti_env->GetAllThreads(&threadsCountPtr, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);
test_passed = JNI_FALSE;
}
err = jvmti_env->GetAllThreads(NULL, NULL);
err = jvmti_env->GetAllThreads(nullptr, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
JNIEXPORT jint JNICALL
@ -42,7 +42,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiCapabilities caps;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -64,7 +64,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) {
jvmtiError err;
jobject monitor;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -80,7 +80,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) {
LOG(">>> null pointer check ...\n");
err = jvmti->GetCurrentContendedMonitor(thread, NULL);
err = jvmti->GetCurrentContendedMonitor(thread, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
JNIEXPORT jint JNICALL
@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv !\n");
return JNI_ERR;
}
@ -54,7 +54,7 @@ Java_framecnt02_checkFrames(JNIEnv *env, jclass cls, jthread thr, jint thr_num)
jint frameCount;
if (thr_num == 0) {
err = jvmti->GetFrameCount(thr, NULL);
err = jvmti->GetFrameCount(thr, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
JNIEXPORT jint JNICALL
@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -53,7 +53,7 @@ Java_framecnt03_check(JNIEnv *env, jclass cls) {
jvmtiError err;
jint countPtr;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jint result = PASSED;
static jboolean printdump = JNI_FALSE;
@ -43,12 +43,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res;
if (options != NULL && strcmp(options, "printdump") == 0) {
if (options != nullptr && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
}
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -84,7 +84,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) {
jmethodID mid;
jlocation loc;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -123,7 +123,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) {
if (printdump == JNI_TRUE) {
LOG(">>> (methodPtr) null pointer check ...\n");
}
err = jvmti->GetFrameLocation(thr, 0, NULL, &loc);
err = jvmti->GetFrameLocation(thr, 0, nullptr, &loc);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" actual: %s (%d)\n", TranslateError(err), err);
@ -133,7 +133,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) {
if (printdump == JNI_TRUE) {
LOG(">>> (locationPtr) null pointer check ...\n");
}
err = jvmti->GetFrameLocation(thr, 0, &mid, NULL);
err = jvmti->GetFrameLocation(thr, 0, &mid, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" actual: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
static jboolean printdump = JNI_FALSE;
@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
if (options != NULL && strcmp(options, "printdump") == 0) {
if (options != nullptr && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
}
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -59,7 +59,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) {
jvmtiFrameInfo frame;
jint count;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -85,7 +85,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) {
if (printdump == JNI_TRUE) {
LOG(">>> (stack_buffer) null pointer check ...\n");
}
err = jvmti->GetStackTrace(thread, 0, 1, NULL, &count);
err = jvmti->GetStackTrace(thread, 0, 1, nullptr, &count);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(stack_buffer) error expected: JVMTI_ERROR_NULL_POINTER,");
LOG(" got: %s (%d)\n", TranslateError(err), err);
@ -95,7 +95,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) {
if (printdump == JNI_TRUE) {
LOG(">>> (count_ptr) null pointer check ...\n");
}
err = jvmti->GetStackTrace(thread, 0, 1, &frame, NULL);
err = jvmti->GetStackTrace(thread, 0, 1, &frame, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(count_ptr) error expected: JVMTI_ERROR_NULL_POINTER,");
LOG(" got: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
static jboolean printdump = JNI_FALSE;
@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
if (options != NULL && strcmp(options, "printdump") == 0) {
if (options != nullptr && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
}
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -59,7 +59,7 @@ Java_getstacktr09_check(JNIEnv *env, jclass cls, jthread thread1, jthread thread
jvmtiFrameInfo frame;
jint count;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
static jboolean printdump = JNI_FALSE;
@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
if (options != NULL && strcmp(options, "printdump") == 0) {
if (options != nullptr && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
}
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -58,7 +58,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) {
jvmtiError err;
jvmtiThreadInfo inf;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -66,14 +66,14 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) {
if (printdump == JNI_TRUE) {
LOG(">>> invalid thread check ...\n");
}
err = jvmti->GetThreadInfo(NULL, &inf);
err = jvmti->GetThreadInfo(nullptr, &inf);
if (err != JVMTI_ERROR_NONE) {
LOG("Error expected: JVMTI_ERROR_NONE,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
}
if (inf.name == NULL || strcmp(inf.name, "main")) {
if (inf.name == nullptr || strcmp(inf.name, "main")) {
LOG("Thread %s: incorrect name: %s\n", "main", inf.name);
result = STATUS_FAILED;
}
@ -93,7 +93,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) {
if (printdump == JNI_TRUE) {
LOG(">>> null pointer check ...\n");
}
err = jvmti->GetThreadInfo(thr, NULL);
err = jvmti->GetThreadInfo(thr, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint result = PASSED;
static jboolean printdump = JNI_FALSE;
@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
if (options != NULL && strcmp(options, "printdump") == 0) {
if (options != nullptr && strcmp(options, "printdump") == 0) {
printdump = JNI_TRUE;
}
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -58,7 +58,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) {
jvmtiError err;
jint thrState;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return STATUS_FAILED;
}
@ -66,7 +66,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) {
if (printdump == JNI_TRUE) {
LOG(">>> (threadStatePtr) null pointer check ...\n");
}
err = jvmti->GetThreadState(thr, NULL);
err = jvmti->GetThreadState(thr, nullptr);
if (err != JVMTI_ERROR_NULL_POINTER) {
LOG("(threadStatePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n");
LOG(" got: %s (%d)\n", TranslateError(err), err);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ const char CONTINUATION_METHOD_NAME[] = "enter";
static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
jvmtiFrameInfo frames[MAX_FRAME_COUNT];
jint count = -1;
jmethodID method = NULL;
jmethodID method = nullptr;
jvmtiError err;
err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count);
@ -78,7 +78,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
LOG("Agent: started\n");
while (true) {
jthread *threads = NULL;
jthread *threads = nullptr;
jint count = 0;
jvmtiError err;
@ -90,7 +90,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
}
check_jvmti_status(jni, err, "Error in JVMTI GetAllThreads");
for (int i = 0; i < count; i++) {
jthread tested_thread = NULL;
jthread tested_thread = nullptr;
err = GetVirtualThread(jvmti, jni, threads[i], &tested_thread);
if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
@ -100,7 +100,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
return;
}
check_jvmti_status(jni, err, "Error in JVMTI extension GetVirtualThread");
if (tested_thread != NULL) {
if (tested_thread != nullptr) {
test_stack_trace(jvmti, jni, tested_thread);
}
}
@ -132,7 +132,7 @@ extern JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *res
return JNI_ERR;
}
if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,13 +31,13 @@
static const char CONTINUATION_CLASS_NAME[] = "jdk/internal/vm/Continuation";
static const char CONTINUATION_METHOD_NAME[] = "enter";
static jrawMonitorID event_mon = NULL;
static jrawMonitorID event_mon = nullptr;
static void
test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
jvmtiFrameInfo frames[MAX_FRAME_COUNT];
jint count = -1;
jmethodID method = NULL;
jmethodID method = nullptr;
jvmtiError err;
err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count);
@ -93,7 +93,7 @@ check_link_consistency(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
fatal(jni, "Carrier thread is NOT expected to be suspended");
}
if (cthread != NULL) {
if (cthread != nullptr) {
jthread cthread_to_vthread = get_virtual_thread(jvmti, jni, cthread);
if (!jni->IsSameObject(vthread, cthread_to_vthread)) {
@ -118,12 +118,12 @@ check_vthread_consistency_suspended(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthrea
jni->FatalError("Agent: check_vthread_consistency_suspended: vthread is expected to be virtual");
}
jthread cthread = get_carrier_thread(jvmti, jni, vthread);
//const char* cname = (cthread == NULL) ? "<no cthread>" : get_thread_name(jvmti, jni, cthread);
//const char* cname = (cthread == nullptr) ? "<no cthread>" : get_thread_name(jvmti, jni, cthread);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, vthread);
check_jvmti_status(jni, err, "Error in JVMTI SetEventNotificationMode: enable SINGLE_STEP");
if (cthread != NULL) { // pre-condition for reliable testing
if (cthread != nullptr) { // pre-condition for reliable testing
test_stack_trace(jvmti, jni, vthread);
check_link_consistency(jvmti, jni, vthread);
}
@ -145,7 +145,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread,
print_stack_trace(jvmti, jni, thread);
jthread cthread = get_carrier_thread(jvmti, jni, thread);
if (cthread != NULL) {
if (cthread != nullptr) {
print_stack_trace(jvmti, jni, cthread);
}
@ -170,7 +170,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
int iter = 0;
while (true) {
jthread *threads = NULL;
jthread *threads = nullptr;
jint count = 0;
jvmtiError err;
@ -182,7 +182,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
for (int i = 0; i < count; i++) {
jthread cthread = threads[i];
jthread vthread = NULL;
jthread vthread = nullptr;
err = GetVirtualThread(jvmti, jni, cthread, &vthread);
if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
@ -192,7 +192,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
return;
}
check_jvmti_status(jni, err, "Error in GetVirtualThread");
if (iter > 50 && vthread != NULL) {
if (iter > 50 && vthread != nullptr) {
// char* cname = get_thread_name(jvmti, jni, cthread);
// char* vname = get_thread_name(jvmti, jni, vthread);
@ -256,7 +256,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,15 +48,15 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons
jvmtiError err = jvmti->GetThreadLocalStorage(thread, (void **) &storage);
if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
return NULL;
return nullptr;
}
check_jvmti_status(jni, err, "Error in GetThreadLocalStorage");
LOG("Check %s with %p in %s\n", thread_info.name, storage, source);
if (storage == NULL) {
if (storage == nullptr) {
// Might be not set
return NULL;
return nullptr;
}
if (storage->self_pointer != storage || (strcmp(thread_info.name, storage->data) != 0)) {
@ -71,12 +71,12 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons
void check_delete_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, const char* source) {
StorageStructure *storage = check_tls(jvmti, jni, thread, source);
if (storage == NULL) {
if (storage == nullptr) {
return;
}
check_jvmti_status(jni, jvmti->Deallocate((unsigned char *)storage), "Deallocation failed.");
jvmtiError err = jvmti->SetThreadLocalStorage(thread, NULL);
jvmtiError err = jvmti->SetThreadLocalStorage(thread, nullptr);
if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) {
return;
}
@ -125,7 +125,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
LOG("Started.....\n");
while (true) {
jthread *threads = NULL;
jthread *threads = nullptr;
jint count = 0;
sleep_ms(10);
@ -136,7 +136,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
}
check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads");
for (int i = 0; i < count; i++) {
jthread testedThread = NULL;
jthread testedThread = nullptr;
jvmtiError err;
err = GetVirtualThread(jvmti, jni, threads[i], &testedThread);
@ -145,7 +145,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) {
}
check_jvmti_status(jni, err, "Error in GetVirtualThread");
if (testedThread == NULL) {
if (testedThread == nullptr) {
testedThread = threads[i];
continue;
}
@ -205,7 +205,7 @@ VirtualThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv * jvmti = NULL;
jvmtiEnv * jvmti = nullptr;
jvmtiEventCallbacks callbacks;
jvmtiCapabilities caps;
@ -213,7 +213,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -250,19 +250,19 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr);
jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr);
err = init_agent_data(jvmti, &agent_data);
if (err != JVMTI_ERROR_NONE) {
return JNI_ERR;
}
if (set_agent_proc(agentProc, NULL) != JNI_TRUE) {
if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) {
return JNI_ERR;
}
return JNI_OK;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -93,7 +93,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -162,7 +162,7 @@ JNIEXPORT void
Java_allthr01_startAgentThread(JNIEnv *jni) {
RawMonitorLocker rml1 = RawMonitorLocker(jvmti_env, jni, starting_agent_thread_lock);
jvmtiError err = jvmti_env->RunAgentThread(create_jthread(jni),
sys_thread, NULL,JVMTI_THREAD_NORM_PRIORITY);
sys_thread, nullptr,JVMTI_THREAD_NORM_PRIORITY);
check_jvmti_status(jni, err, "Failed to run AgentThread");
rml1.wait();
LOG("Started Agent Thread\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,13 +29,13 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv !\n");
return JNI_ERR;
}
@ -54,7 +54,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_contmon01_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread, jobject lock) {
jobject monitor = NULL;
jobject monitor = nullptr;
jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor);
if (err == JVMTI_ERROR_THREAD_NOT_ALIVE && point == 5) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -34,7 +34,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv !\n");
return JNI_ERR;
}
@ -56,7 +56,7 @@ Java_contmon02_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread)
jobject monitor;
jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor);
check_jvmti_status(jni, err, "Error in GetCurrentContendedMonitor");
if (monitor != NULL) {
if (monitor != nullptr) {
LOG("(#%d) unexpected monitor object: 0x%p\n", point, monitor);
fatal(jni, "GetCurrentContendedMonitor return unexpected monitor.");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,7 @@
extern "C" {
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
@ -35,7 +35,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res;
res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,7 +31,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
static jint result = PASSED;
static jmethodID mid1;
@ -40,7 +40,7 @@ static jmethodID mid1;
jboolean checkFrame(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID exp_mid,
jlocation exp_loc, jlocation exp_loc_alternative, jboolean mustPass) {
jvmtiError err;
jmethodID mid = NULL;
jmethodID mid = nullptr;
jlocation loc = -1;
char *meth, *sig, *generic;
jboolean isOk = JNI_FALSE;
@ -88,7 +88,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv !\n");
return JNI_ERR;
}
@ -115,13 +115,13 @@ JNIEXPORT void JNICALL
Java_frameloc01_getReady(JNIEnv *jni, jclass cls, jclass klass) {
jvmtiError err;
mid1 = jni->GetMethodID(klass, "meth01", "(I)V");
if (mid1 == NULL) {
if (mid1 == nullptr) {
LOG("Cannot get jmethodID for method \"meth01\"\n");
result = STATUS_FAILED;
return;
}
err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL);
err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err);
result = STATUS_FAILED;
@ -134,7 +134,7 @@ Java_frameloc01_checkFrame01(JNIEnv *jni, jclass cls, jthread thr, jclass klass,
jboolean isOk = JNI_FALSE;
mid = jni->GetMethodID(klass, "run", "()V");
if (mid == NULL) {
if (mid == nullptr) {
LOG("Cannot get jmethodID for method \"run\"\n");
result = STATUS_FAILED;
return JNI_TRUE;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -38,7 +38,7 @@ typedef struct {
jlocation loc;
} frame_info;
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
static jint result = PASSED;
static frame_info fi =
{"Lframeloc02;", "check",
@ -47,7 +47,7 @@ static frame_info fi =
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -98,17 +98,17 @@ Java_frameloc02_check(JNIEnv *env, jclass cls, jthread thr) {
LOG(">>> method: \"%s%s\"\n", name, sig);
LOG(">>> location: %s\n", jlong_to_string(loc, buffer));
if (cls_sig == NULL || strcmp(cls_sig, fi.cls_sig) != 0) {
if (cls_sig == nullptr || strcmp(cls_sig, fi.cls_sig) != 0) {
LOG("(GetFrameLocation) wrong class: \"%s\"\n", cls_sig);
LOG(", expected: \"%s\"\n", fi.cls_sig);
result = STATUS_FAILED;
}
if (name == NULL || strcmp(name, fi.name) != 0) {
if (name == nullptr || strcmp(name, fi.name) != 0) {
LOG("(GetFrameLocation) wrong method name: \"%s\"", name);
LOG(", expected: \"%s\"\n", fi.name);
result = STATUS_FAILED;
}
if (sig == NULL || strcmp(sig, fi.sig) != 0) {
if (sig == nullptr || strcmp(sig, fi.sig) != 0) {
LOG("(GetFrameLocation) wrong method signature: \"%s\"", sig);
LOG(", expected: \"%s\"\n", fi.sig);
result = STATUS_FAILED;

View File

@ -30,14 +30,14 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jmethodID* ids = NULL;
static jvmtiEnv *jvmti = nullptr;
static jmethodID* ids = nullptr;
static int ids_size = 0;
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
printf("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -71,11 +71,11 @@ Java_GetStackTraceAndRetransformTest_check(JNIEnv *jni, jclass cls, jint expecte
exit(2);
}
for (int i = 0; i < ids_size; i++) {
jclass rslt = NULL;
char* class_name = NULL;
jclass rslt = nullptr;
char* class_name = nullptr;
jvmti->GetMethodDeclaringClass(ids[i], &rslt);
if (rslt != NULL) {
jvmti->GetClassSignature(rslt, &class_name, NULL);
if (rslt != nullptr) {
jvmti->GetClassSignature(rslt, &class_name, nullptr);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static frame_info expected_virtual_frames[] = {
{"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"},
{"LGetStackTraceCurrentThreadTest;", "dummy", "()V"},
@ -52,7 +52,7 @@ static frame_info expected_platform_frames[] = {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
printf("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static frame_info expected_platform_frames[] = {
{"Ljava/lang/Object;", "wait", "()V"},
{"Lgetstacktr03;", "dummy", "()V"},
@ -55,7 +55,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jmethodID mid;
static frame_info expected_platform_frames[] = {
{"Lgetstacktr04$TestThread;", "checkPoint", "()V"},
@ -80,7 +80,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -108,12 +108,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_getstacktr04_getReady(JNIEnv *jni, jclass cls, jclass clazz) {
mid = jni->GetMethodID(clazz, "checkPoint", "()V");
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("Cannot find Method ID for method checkPoint\n");
}
check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,7 +29,7 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
static jmethodID mid;
@ -102,7 +102,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -132,11 +132,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_getstacktr05_getReady(JNIEnv *jni, jclass cls, jclass clazz) {
mid = jni->GetMethodID(clazz, "checkPoint", "()V");
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("Cannot find Method ID for method checkPoint\n");
}
check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,7 +33,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
static jmethodID mid;
@ -67,7 +67,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID
}
check_jvmti_status(jni, jvmti->ClearBreakpoint(mid, 0), "ClearBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, nullptr);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr);
LOG(">>> popping frame ...\n");
@ -92,7 +92,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -128,12 +128,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
JNIEXPORT void JNICALL
Java_getstacktr06_getReady(JNIEnv *jni, jclass cls, jclass clazz) {
mid = jni->GetMethodID(clazz, "checkPoint", "()V");
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("Cannot find Method ID for method checkPoint\n");
}
check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ extern "C" {
#define PASSED 0
#define STATUS_FAILED 2
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiCapabilities caps;
static jvmtiEventCallbacks callbacks;
static jint result = PASSED;
@ -73,7 +73,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho
jni->FatalError("ERROR: don't know where we get called from");
}
if (classBytes == NULL) {
if (classBytes == nullptr) {
jni->FatalError("ERROR: don't have any bytes");
}
@ -83,11 +83,11 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho
class_def.klass = klass;
class_def.class_byte_count = jni->GetArrayLength(classBytes);
class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL);
class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr);
check_jvmti_status(jni, jvmti->RedefineClasses(1, &class_def), "RedefineClasses failed.");
jni->DeleteGlobalRef(classBytes);
classBytes = NULL;
classBytes = nullptr;
frame_info *expected_frames = jni->IsVirtualThread(thread)
? expected_virtual_frames
@ -105,7 +105,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -137,12 +137,12 @@ Java_getstacktr07_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt
classBytes = (jbyteArray) jni->NewGlobalRef(bytes);
mid = jni->GetMethodID(clazz, "checkPoint", "()V");
if (mid == NULL) {
if (mid == nullptr) {
jni->FatalError("Cannot find Method ID for method checkPoint\n");
}
check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jvmtiEventCallbacks callbacks;
static jboolean wasFramePop = JNI_FALSE;
static jmethodID mid_checkPoint, mid_chain4;
@ -116,7 +116,7 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni,
}
if (classBytes == NULL) {
if (classBytes == nullptr) {
jni->FatalError("ERROR: don't have any bytes");
}
@ -125,11 +125,11 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni,
classDef.klass = klass;
classDef.class_byte_count = jni->GetArrayLength(classBytes);
classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL);
classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr);
check_jvmti_status(jni, jvmti_env->RedefineClasses(1, &classDef), "RedefineClasses failed.");
jni->DeleteGlobalRef(classBytes);
classBytes = NULL;
classBytes = nullptr;
if (!compare_stack_trace(jvmti_env, jni, thread, 2)) {
jni->ThrowNew(jni->FindClass("java/lang/RuntimeException"), "Stacktrace differs from expected.");
}
@ -140,7 +140,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -176,12 +176,12 @@ Java_getstacktr08_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt
mid_chain4 = jni->GetStaticMethodID(clazz, "chain4", "()V");
check_jvmti_status(jni, jvmti->SetBreakpoint(mid_checkPoint, 0), "SetBreakpoint failed.");
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
}
JNIEXPORT void JNICALL
Java_getstacktr08_nativeChain(JNIEnv *jni, jclass cls, jclass clazz) {
if (mid_chain4 != NULL) {
if (mid_chain4 != nullptr) {
jni->CallStaticVoidMethod(clazz, mid_chain4);
}
if (!compare_stack_trace(jvmti, jni, get_current_thread(jvmti, jni), 3)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -35,7 +35,7 @@ typedef struct {
jboolean is_daemon;
} info;
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
static info expected_info_array[] = {
{"main", JNI_TRUE,JVMTI_THREAD_NORM_PRIORITY, JNI_FALSE},
{"thread1",JNI_TRUE,JVMTI_THREAD_MIN_PRIORITY + 2, JNI_TRUE},
@ -49,7 +49,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiCapabilities caps;
res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti_env == NULL) {
if (res != JNI_OK || jvmti_env == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -75,8 +75,8 @@ Java_thrinfo01_checkInfo0(JNIEnv *jni, jclass cls, jthread thread, jthreadGroup
info expected_info = expected_info_array[expected_idx];
check_jvmti_status(jni, jvmti_env->GetThreadInfo(thread, &inf), "Error in GetThreadInfo.");
if (inf.name == NULL) {
LOG("Thread %s: incorrect name in NULL\n", expected_info.name);
if (inf.name == nullptr) {
LOG("Thread %s: incorrect name in null\n", expected_info.name);
result = JNI_FALSE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,11 +31,11 @@ extern "C" {
#define WAIT_START 100
#define WAIT_TIME (2*60*1000)
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jrawMonitorID access_lock;
static jrawMonitorID wait_lock;
static jthread tested_thread_thr1 = NULL;
static jthread tested_thread_thr1 = nullptr;
static jint state[] = {
JVMTI_THREAD_STATE_RUNNABLE,
@ -45,9 +45,9 @@ static jint state[] = {
void JNICALL
VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) {
jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
check_jvmti_status(jni, err, "Error in SetEventNotificationMode");
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr);
check_jvmti_status(jni, err, "Error in SetEventNotificationMode");
}
@ -58,7 +58,7 @@ ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) {
jvmtiThreadInfo thread_info = get_thread_info(jvmti, jni, thread);
LOG(">>> ThreadStart: \"%s\"\n", thread_info.name);
if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) {
if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) {
tested_thread_thr1 = jni->NewGlobalRef(thread);
LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, tested_thread_thr1);
}
@ -72,7 +72,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
LOG("Agent_OnLoad started\n");
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -101,7 +101,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -117,7 +117,7 @@ Java_thrstat01_checkStatus0(JNIEnv *jni, jclass cls, jint stat_ind) {
LOG("native method checkStatus started\n");
if (tested_thread_thr1 == NULL) {
if (tested_thread_thr1 == nullptr) {
LOG("Missing thread \"tested_thread_thr1\" start event\n");
return JNI_FALSE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,9 +30,9 @@ extern "C" {
#define WAIT_START 100
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jrawMonitorID access_lock, wait_lock;
static jthread thr_ptr = NULL;
static jthread thr_ptr = nullptr;
static jint wait_time = 0;
static jint state[] = {
JVMTI_THREAD_STATE_RUNNABLE,
@ -55,7 +55,7 @@ void printStateFlags(jint flags) {
void JNICALL
VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) {
jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
check_jvmti_status(jni, err, "Failed to enable THREAD_START event");
}
@ -63,7 +63,7 @@ void JNICALL
ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) {
RawMonitorLocker rml = RawMonitorLocker(jvmti, jni, access_lock);
jvmtiThreadInfo thread_info = get_thread_info(jvmti_env, jni, thread);
if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) {
if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) {
thr_ptr = jni->NewGlobalRef(thread);
LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, thr_ptr);
}
@ -77,7 +77,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiError err;
res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -103,7 +103,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("Failed to enable VM_INIT event: %s (%d)\n", TranslateError(err), err);
return JNI_ERR;
@ -135,12 +135,12 @@ Java_thrstat02_checkStatus0(JNIEnv *jni, jclass cls, jint statInd, jboolean susp
jboolean timeout_is_reached;
unsigned int waited_millis;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return JNI_FALSE;
}
if (thr_ptr == NULL) {
if (thr_ptr == nullptr) {
LOG("Missing thread \"tested_thread_thr1\" start event\n");
return JNI_FALSE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,7 @@ extern "C" {
#define WAIT_START 100
static jvmtiEnv *jvmti = NULL;
static jvmtiEnv *jvmti = nullptr;
static jint wait_time = 0;
static jint state[] = {
0, /* JVMTI_THREAD_STATUS_NOT_STARTED, */
@ -46,7 +46,7 @@ Java_thrstat03_init(JNIEnv *env, jclass cls, jint waitTime) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -59,7 +59,7 @@ Java_thrstat03_check(JNIEnv *jni, jclass cls, jthread thread, jint statInd) {
jrawMonitorID wait_lock;
jint thr_state = 0;
if (jvmti == NULL) {
if (jvmti == nullptr) {
LOG("JVMTI client was not properly loaded!\n");
return JNI_FALSE;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -66,7 +66,7 @@ static int g_ThreadState[] = {
| JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, /* TS_RUN_WAIT_SLEEPING */
};
static jvmtiEnv *jvmti_env = NULL;
static jvmtiEnv *jvmti_env = nullptr;
static int g_wait_time = 1000;
jrawMonitorID wait_lock; /* Monitor is used just for sleeping */
@ -75,7 +75,7 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1);
if (res != JNI_OK || !jvmti_env) {
LOG("Agent_OnLoad: Error: GetEnv returned error or NULL\n");
LOG("Agent_OnLoad: Error: GetEnv returned error or null\n");
return JNI_ERR;
}
wait_lock = create_raw_monitor(jvmti_env, "beast");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -48,11 +48,11 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
/* perform testing */
{
jthread testedThread = NULL;
jthread testedThread = nullptr;
LOG("Find thread: %s\n", THREAD_NAME);
testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME);
if (testedThread == NULL) {
if (testedThread == nullptr) {
return;
}
LOG(" ... found thread: %p\n", (void *) testedThread);
@ -100,13 +100,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv *jvmti = NULL;
jvmtiEnv *jvmti = nullptr;
timeout = 60 * 1000;
LOG("Agent_OnLoad started\n");
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = {
};
static volatile int eventsReceived = 0;
static jthread testedThread = NULL;
static jthread testedThread = nullptr;
/* ============================================================================= */
@ -59,14 +59,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
{
LOG("Find thread: %s\n", THREAD_NAME);
testedThread = find_thread_by_name(jvmti, jni,THREAD_NAME);
if (testedThread == NULL) {
if (testedThread == nullptr) {
return;
}
LOG(" ... found thread: %p\n", (void*)testedThread);
eventsReceived = 0;
LOG("Enable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Suspend thread: %p\n", (void*)testedThread);
jvmtiError err = jvmti->SuspendThread(testedThread);
@ -102,7 +102,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
}
LOG("Disable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Wait for thread to finish\n");
if (!agent_wait_for_sync(timeout))
@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
JNIEXPORT void JNICALL
callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
/* check if event is for tested thread */
if (thread != NULL && jni->IsSameObject(testedThread, thread)) {
if (thread != nullptr && jni->IsSameObject(testedThread, thread)) {
LOG(" ... received THREAD_END event for tested thread: %p\n", (void*)thread);
eventsReceived++;
} else {
@ -136,12 +136,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
/** Agent library initialization. */
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv* jvmti = NULL;
jvmtiEnv* jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -173,7 +173,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -52,8 +52,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
/* perform testing */
{
jthread* threads = NULL;
jvmtiError* results = NULL;
jthread* threads = nullptr;
jvmtiError* results = nullptr;
LOG("Allocate threads array: %d threads\n", THREADS_COUNT);
check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), (unsigned char**)&threads), "");
@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
LOG("Delete threads references\n");
for (int i = 0; i < THREADS_COUNT; i++) {
if (threads[i] != NULL)
if (threads[i] != nullptr)
jni->DeleteGlobalRef(threads[i]);
}
@ -143,13 +143,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
const char name[], int foundCount, jthread foundThreads[]) {
jint count = 0;
jthread* threads = NULL;
jthread* threads = nullptr;
size_t len = strlen(name);
int found = 0;
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = NULL;
foundThreads[i] = nullptr;
}
check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads");
@ -159,7 +159,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
jvmtiThreadInfo info;
check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), "");
if (info.name != NULL && strncmp(name, info.name, len) == 0) {
if (info.name != nullptr && strncmp(name, info.name, len) == 0) {
LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name);
if (found < foundCount)
foundThreads[found] = threads[i];
@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
LOG("Make global references for threads: %d threads\n", foundCount);
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if ( foundThreads[i] == NULL) {
if ( foundThreads[i] == nullptr) {
set_agent_fail_status();
return JNI_FALSE;
}
@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv* jvmti = NULL;
jvmtiEnv* jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -219,7 +219,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = {
};
static const int THREADS_COUNT = 10;
static jthread* threads = NULL;
static jthread* threads = nullptr;
static volatile int eventsReceived = 0;
static jrawMonitorID eventsReceivedMtx = 0;
@ -65,7 +65,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
/* perform testing */
{
jvmtiError* results = NULL;
jvmtiError* results = nullptr;
LOG("Allocate threads array: %d threads\n", THREADS_COUNT);
check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)),
(unsigned char**)&threads), "");
@ -98,7 +98,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
eventsReceived = 0;
LOG("Enable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Let threads to run and finish\n");
if (!agent_resume_sync())
@ -136,7 +136,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
}
LOG("Disable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Wait for thread to finish\n");
if (!agent_wait_for_sync(timeout))
@ -144,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
LOG("Delete threads references\n");
for (int i = 0; i < THREADS_COUNT; i++) {
if (threads[i] != NULL)
if (threads[i] != nullptr)
jni->DeleteGlobalRef(threads[i]);
}
@ -164,13 +164,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
const char name[], int foundCount, jthread foundThreads[]) {
jint count = 0;
jthread* threads = NULL;
jthread* threads = nullptr;
size_t len = strlen(name);
int found = 0;
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = NULL;
foundThreads[i] = nullptr;
}
check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads");
@ -180,7 +180,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
jvmtiThreadInfo info;
check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), "");
if (info.name != NULL && strncmp(name, info.name, len) == 0) {
if (info.name != nullptr && strncmp(name, info.name, len) == 0) {
LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name);
if (found < foundCount)
foundThreads[found] = threads[i];
@ -203,7 +203,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
LOG("Make global references for threads: %d threads\n", foundCount);
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if ( foundThreads[i] == NULL) {
if ( foundThreads[i] == nullptr) {
set_agent_fail_status();
return JNI_FALSE;
}
@ -221,7 +221,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
/* check if event is for tested thread */
for (int i = 0; i < THREADS_COUNT; i++) {
if (thread != NULL && jni->IsSameObject(threads[i], thread)) {
if (thread != nullptr && jni->IsSameObject(threads[i], thread)) {
LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread);
eventsReceived++;
jvmti->RawMonitorExit(eventsReceivedMtx);
@ -234,12 +234,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv* jvmti = NULL;
jvmtiEnv* jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -273,7 +273,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -50,7 +50,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
{
LOG("Find thread: %s\n", THREAD_NAME);
jthread tested_thread = find_thread_by_name(jvmti, jni, THREAD_NAME);
if (tested_thread == NULL) {
if (tested_thread == nullptr) {
return;
}
LOG(" ... found thread: %p\n", (void *) tested_thread);
@ -97,12 +97,12 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv *jvmti = NULL;
jvmtiEnv *jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,7 +46,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = {
};
static volatile int eventsReceived = 0;
static jthread testedThread = NULL;
static jthread testedThread = nullptr;
/** Agent algorithm. */
static void JNICALL
@ -61,14 +61,14 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
{
LOG("Find thread: %s\n", THREAD_NAME);
testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME);
if (testedThread == NULL) {
if (testedThread == nullptr) {
return;
}
LOG(" ... found thread: %p\n", (void *) testedThread);
eventsReceived = 0;
LOG("Enable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Suspend thread: %p\n", (void *) testedThread);
err = jvmti->SuspendThread(testedThread);
@ -96,7 +96,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
}
LOG("Disable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Resume thread: %p\n", (void *) testedThread);
err = jvmti->ResumeThread(testedThread);
@ -122,7 +122,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
JNIEXPORT void JNICALL
callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
/* check if event is for tested thread */
if (thread != NULL && jni->IsSameObject(testedThread, thread)) {
if (thread != nullptr && jni->IsSameObject(testedThread, thread)) {
LOG(" ... received THREAD_END event for tested thread: %p\n", (void *) thread);
eventsReceived++;
} else {
@ -132,12 +132,12 @@ callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv *jvmti = NULL;
jvmtiEnv *jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -168,7 +168,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -54,8 +54,8 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
/* perform testing */
{
jthread *threads = NULL;
jvmtiError *results = NULL;
jthread *threads = nullptr;
jvmtiError *results = nullptr;
LOG("Allocate threads array: %d threads\n", THREADS_COUNT);
check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)),
@ -120,7 +120,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
LOG("Delete threads references\n");
for (int i = 0; i < THREADS_COUNT; i++) {
if (threads[i] != NULL)
if (threads[i] != nullptr)
jni->DeleteGlobalRef(threads[i]);
}
@ -141,13 +141,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) {
/** Find threads whose name starts with specified name prefix. */
static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, int found_count, jthread *found_threads) {
jint count = 0;
jthread *threads = NULL;
jthread *threads = nullptr;
size_t len = strlen(name);
int found = 0;
for (int i = 0; i < found_count; i++) {
found_threads[i] = NULL;
found_threads[i] = nullptr;
}
check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads");
@ -158,7 +158,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name,
check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), "");
if (info.name != NULL && strncmp(name, info.name, len) == 0) {
if (info.name != nullptr && strncmp(name, info.name, len) == 0) {
LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name);
if (found < found_count)
found_threads[found] = threads[i];
@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name,
LOG("Make global references for threads: %d threads\n", found_count);
for (int i = 0; i < found_count; i++) {
found_threads[i] = (jthread) jni->NewGlobalRef(found_threads[i]);
if (found_threads[i] == NULL) {
if (found_threads[i] == nullptr) {
set_agent_fail_status();
return JNI_FALSE;
}
@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name,
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv *jvmti = NULL;
jvmtiEnv *jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -216,7 +216,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = {
JVMTI_EVENT_THREAD_END
};
static jthread* threads = NULL;
static jthread* threads = nullptr;
static volatile int eventsReceived = 0;
@ -66,7 +66,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
/* perform testing */
{
jvmtiError* results = NULL;
jvmtiError* results = nullptr;
LOG("Allocate threads array: %d threads\n", THREADS_COUNT);
check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)),
@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
eventsReceived = 0;
LOG("Enable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Let threads to run and finish\n");
if (!agent_resume_sync())
@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
}
LOG("Disable event: %s\n", "THREAD_END");
enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL);
enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr);
LOG("Resume threads list\n");
err = jvmti->ResumeThreadList(THREADS_COUNT, threads, results);
@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
LOG("Delete threads references\n");
for (int i = 0; i < THREADS_COUNT; i++) {
if (threads[i] != NULL) {
if (threads[i] != nullptr) {
jni->DeleteGlobalRef(threads[i]);
}
}
@ -159,12 +159,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
const char name[], int foundCount, jthread foundThreads[]) {
jint count = 0;
jthread* threads = NULL;
jthread* threads = nullptr;
size_t len = strlen(name);
int found = 0;
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = NULL;
foundThreads[i] = nullptr;
}
check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "");
@ -174,7 +174,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
jvmtiThreadInfo info;
check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), "");
if (info.name != NULL && strncmp(name, info.name, len) == 0) {
if (info.name != nullptr && strncmp(name, info.name, len) == 0) {
LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name);
if (found < foundCount) {
foundThreads[found] = threads[i];
@ -198,7 +198,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni,
LOG("Make global references for threads: %d threads\n", foundCount);
for (int i = 0; i < foundCount; i++) {
foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]);
if (foundThreads[i] == NULL) {
if (foundThreads[i] == nullptr) {
set_agent_fail_status();
return JNI_FALSE;
}
@ -213,7 +213,7 @@ JNIEXPORT void JNICALL
callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
/* check if event is for tested thread */
for (int i = 0; i < THREADS_COUNT; i++) {
if (thread != NULL && jni->IsSameObject(threads[i], thread)) {
if (thread != nullptr && jni->IsSameObject(threads[i], thread)) {
LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread);
eventsReceived++;
return;
@ -224,12 +224,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
jvmtiEnv* jvmti = NULL;
jvmtiEnv* jvmti = nullptr;
timeout = 60 * 1000;
jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9);
if (res != JNI_OK || jvmti == NULL) {
if (res != JNI_OK || jvmti == nullptr) {
LOG("Wrong result of a valid call to GetEnv!\n");
return JNI_ERR;
}
@ -261,7 +261,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
}
/* register agent proc and arg */
if (!set_agent_proc(agentProc, NULL)) {
if (!set_agent_proc(agentProc, nullptr)) {
return JNI_ERR;
}
return JNI_OK;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@
extern "C" {
static jvmtiEnv *jvmti = NULL;
static jrawMonitorID event_mon = NULL;
static jvmtiEnv *jvmti = nullptr;
static jrawMonitorID event_mon = nullptr;
static int method_entry_count = 0;
static int method_exit_count = 0;
static int breakpoint_count = 0;
@ -63,7 +63,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname)
jlocation location = (jlocation)0L;
jvmtiError err;
if (method == NULL) {
if (method == nullptr) {
jni->FatalError("Error in set_breakpoint: not found method");
}
err = jvmti->SetBreakpoint(method, location);
@ -131,13 +131,13 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) {
if (done) {
return; // defence against JVMTI_ERROR_WRONG_PHASE failures
}
jmethodID method = NULL;
jmethodID method = nullptr;
jlocation loc = 0L;
jvmtiError err;
va_list ap;
JNIEnv* jni = NULL;
jthread thread = NULL;
JNIEnv* jni = nullptr;
jthread thread = nullptr;
va_start(ap, jvmti);
jni = va_arg(ap, JNIEnv*);
@ -162,13 +162,13 @@ VirtualThreadUnmount(jvmtiEnv *jvmti, ...) {
if (done) {
return; // defence against JVMTI_ERROR_WRONG_PHASE failures
}
jmethodID method = NULL;
jmethodID method = nullptr;
jlocation loc = 0L;
jvmtiError err;
va_list ap;
JNIEnv* jni = NULL;
jthread thread = NULL;
JNIEnv* jni = nullptr;
jthread thread = nullptr;
va_start(ap, jvmti);
jni = va_arg(ap, JNIEnv*);
@ -239,24 +239,24 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("error in JVMTI SetEventNotificationMode: %d\n", err);
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("error in JVMTI SetEventNotificationMode: %d\n", err);
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("error in JVMTI SetEventNotificationMode: %d\n", err);
return JNI_ERR;
}
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr);
if (err != JVMTI_ERROR_NONE) {
LOG("error in JVMTI SetEventNotificationMode: %d\n", err);
return JNI_ERR;
@ -276,16 +276,16 @@ Java_BreakpointInYieldTest_enableEvents(JNIEnv *jni, jclass klass, jthread threa
LOG("enableEvents: started\n");
jclass k1 = find_class(jvmti, jni, NULL, "Ljava/lang/VirtualThread;");
jclass k2 = find_class(jvmti, jni, NULL, "Ljdk/internal/vm/Continuation;");
if (k1 == NULL || k2 == NULL) {
jclass k1 = find_class(jvmti, jni, nullptr, "Ljava/lang/VirtualThread;");
jclass k2 = find_class(jvmti, jni, nullptr, "Ljdk/internal/vm/Continuation;");
if (k1 == nullptr || k2 == nullptr) {
jni->FatalError("Did not find one of the classes by name: VirtualThread or Continuation");
}
set_breakpoint(jni, k1, "run");
set_breakpoint(jni, k2, "yield");
// Enable Breakpoint events globally
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT");
LOG("enableEvents: finished\n");
@ -297,19 +297,19 @@ Java_BreakpointInYieldTest_check(JNIEnv *jni, jclass cls) {
jvmtiError err;
done = true; // defence against JVMTI_ERROR_WRONG_PHASE failures
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr);
check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable THREAD_START");
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr);
check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_START");
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr);
check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_MOUNT");
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr);
check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_UNMOUNT");
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL);
err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr);
check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable BREAKPOINT");
LOG("\n");

Some files were not shown because too many files have changed in this diff Show More