test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp
changeset 54744 be7839b9493f
parent 52293 d01d4bd7c5b3
child 57629 7aba63ce3b3a
equal deleted inserted replaced
54743:ba74d2de9a01 54744:be7839b9493f
     1 /*
     1 /*
     2  * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 #include <string.h>
    24 #include <string.h>
    25 #include "jvmti.h"
    25 #include "jvmti.h"
    26 #include "agent_common.h"
    26 #include "agent_common.h"
       
    27 #include "ExceptionCheckingJniEnv.hpp"
    27 #include "jni_tools.h"
    28 #include "jni_tools.h"
    28 #include "jvmti_tools.h"
    29 #include "jvmti_tools.h"
    29 #include "JVMTITools.h"
    30 #include "JVMTITools.h"
    30 
    31 
    31 extern "C" {
    32 extern "C" {
   434 
   435 
   435 /** Agent algorithm. */
   436 /** Agent algorithm. */
   436 static void JNICALL
   437 static void JNICALL
   437 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
   438 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
   438 
   439 
       
   440     ExceptionCheckingJniEnvPtr ec_jni(agentJNI);
   439     int i;
   441     int i;
   440     jmethodID methodID;
   442     jmethodID methodID;
   441     jclass cls;
   443     jclass cls;
   442 
   444 
   443 
   445 
   444     if (!nsk_jvmti_waitForSync(timeout))
   446     if (!nsk_jvmti_waitForSync(timeout))
   445         return;
   447         return;
   446 
   448 
   447     cls = agentJNI->FindClass(CLASS_NAME);
   449     cls = ec_jni->FindClass(CLASS_NAME, TRACE_JNI_CALL);
   448     if (!NSK_JNI_VERIFY(agentJNI, cls != NULL))
   450     methodID = ec_jni->GetStaticMethodID(cls, METHOD_NAME, "()I", TRACE_JNI_CALL);
   449         return;
       
   450 
       
   451     methodID = agentJNI->GetStaticMethodID(cls, METHOD_NAME, "()I");
       
   452     if (!NSK_JNI_VERIFY(agentJNI, methodID != NULL))
       
   453         return;
       
   454 
   451 
   455     if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(methodID, 0)))
   452     if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(methodID, 0)))
   456         return;
   453         return;
   457 
   454 
   458     if (!nsk_jvmti_resumeSync())
   455     if (!nsk_jvmti_resumeSync())