8333841: Add more logging into setfldw001 tests

Reviewed-by: cjplummer, amenkov, sspitsyn
This commit is contained in:
Leonid Mesnik 2024-06-11 18:40:20 +00:00
parent b77bd5fd6a
commit 7ed8a5c431
5 changed files with 33 additions and 4 deletions

View File

@ -28,8 +28,6 @@
#############################################################################
vmTestbase/nsk/jvmti/AttachOnDemand/attach020/TestDescription.java 8287324 generic-all
vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java 8205957 generic-all
vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/TestDescription.java 8205957 linux-x64,windows-x64
vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/TestDescription.java 8245680 windows-x64
vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 linux-x64,windows-x64

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, 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
@ -48,3 +48,10 @@
* @run main/othervm/native -agentlib:setfldw001 nsk.jvmti.SetFieldAccessWatch.setfldw001
*/
/*
* @test id=logging
*
* @library /vmTestbase
* /test/lib
* @run main/othervm/native -agentlib:setfldw001 -XX:TraceJVMTI=ec+,+ioe,+s -Xlog:jvmti=trace:file=vm.%p.log nsk.jvmti.SetFieldAccessWatch.setfldw001
*/

View File

@ -26,6 +26,7 @@
#include <ctype.h>
#include "jvmti.h"
#include "agent_common.hpp"
#include "jvmti_common.hpp"
#include "JVMTITools.hpp"
extern "C" {
@ -114,6 +115,14 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env,
}
fld_ind = (int)(fld_name[len - 1] - '0'); /* last digit is index in the array */
fields[fld_ind].thrown_fid = field;
if (field == nullptr) {
fatal(env, "null field ID in FieldModification event.");
}
LOG("Event: (Field %d) field ID expected: 0x%p, got: 0x%p\n",
fld_ind, fields[fld_ind].fid, field);
jvmti_env->Deallocate((unsigned char*) fld_name);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, 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
@ -48,3 +48,10 @@
* @run main/othervm/native -agentlib:setfmodw001 nsk.jvmti.SetFieldModificationWatch.setfmodw001
*/
/*
* @test id=logging
*
* @library /vmTestbase
* /test/lib
* @run main/othervm/native -agentlib:setfmodw001 -XX:TraceJVMTI=ec+,+ioe,+s -Xlog:jvmti=trace:file=vm.%p.log nsk.jvmti.SetFieldModificationWatch.setfmodw001
*/

View File

@ -26,6 +26,7 @@
#include <ctype.h>
#include "jvmti.h"
#include "agent_common.hpp"
#include "jvmti_common.hpp"
#include "JVMTITools.hpp"
extern "C" {
@ -108,6 +109,13 @@ void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env,
}
fld_ind = (int)(fld_name[len - 1] - '0'); /* last digit is index in the array */
fields[fld_ind].thrown_fid = field;
if (field == nullptr) {
fatal(env, "null field ID in FieldModification event.");
}
LOG("Event: (Field %d) field ID expected: 0x%p, got: 0x%p\n",
fld_ind, fields[fld_ind].fid, field);
jvmti_env->Deallocate((unsigned char*) fld_name);
}