Skip to content
Permalink
Browse files
8287362: FieldAccessWatch testcase failed on AIX platform
Reviewed-by: cjplummer, mdoerr
  • Loading branch information
Ichiroh Takiguchi committed May 28, 2022
1 parent 410a25d commit 66340372d595aeb4b3dfd9169a8448f363097256
Showing 4 changed files with 14 additions and 9 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, 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
@@ -101,7 +101,7 @@ Agent_OnLoad(JavaVM* vm,
void* reserved) {

jvmtiCapabilities capa;
jvmtiEventCallbacks cbs = {0};
jvmtiEventCallbacks cbs;

(*vm)->GetEnv(vm, (void**)&jvmti, JVMTI_VERSION_1_0);

@@ -110,6 +110,7 @@ Agent_OnLoad(JavaVM* vm,
capa.can_generate_single_step_events = 1;
(*jvmti)->AddCapabilities(jvmti, &capa);

memset(&cbs, 0, sizeof(cbs));
cbs.ClassPrepare = classprepare;
cbs.Breakpoint = breakpoint;
(*jvmti)->SetEventCallbacks(jvmti, &cbs, sizeof(cbs));
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019 SAP SE and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2022 SAP SE 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
@@ -119,14 +119,15 @@ static void JNICALL onFieldAccess(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread

JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
jvmtiCapabilities capa;
jvmtiEventCallbacks cbs = {0};
jvmtiEventCallbacks cbs;

(*vm)->GetEnv(vm, (void**)&jvmti, JVMTI_VERSION_1_0);

memset(&capa, 0, sizeof(capa));
capa.can_generate_field_access_events = 1;
(*jvmti)->AddCapabilities(jvmti, &capa);

memset(&cbs, 0, sizeof(cbs));
cbs.FieldAccess = &onFieldAccess;
(*jvmti)->SetEventCallbacks(jvmti, &cbs, sizeof(cbs));
(*jvmti)->SetEventNotificationMode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, 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
@@ -214,14 +214,15 @@ JNIEXPORT jint JNICALL
Agent_OnLoad(JavaVM *jvm, char *options, void *reserved)
{
jvmtiError err;
jvmtiCapabilities caps = {0};
jvmtiEventCallbacks callbacks = {0};
jvmtiCapabilities caps;
jvmtiEventCallbacks callbacks;
jint res = (*jvm)->GetEnv(jvm, (void **) &jvmti, JVMTI_VERSION_1_1);
if (res != JNI_OK || jvmti == NULL) {
reportError("GetEnv failed", res);
return JNI_ERR;
}

memset(&caps, 0, sizeof(caps));
caps.can_generate_field_modification_events = 1;
caps.can_generate_field_access_events = 1;
caps.can_tag_objects = 1;
@@ -231,6 +232,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved)
return JNI_ERR;
}

memset(&callbacks, 0, sizeof(callbacks));
callbacks.FieldModification = &onFieldModification;
callbacks.FieldAccess = &onFieldAccess;

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, 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,8 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {

if (options != NULL && strcmp(options, "maintain_original_method_order") == 0) {
printf("Enabled capability: maintain_original_method_order\n");
jvmtiCapabilities caps = {};
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_maintain_original_method_order = 1;

jvmtiError err = jvmti->AddCapabilities(&caps);

1 comment on commit 6634037

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 6634037 May 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.