@@ -63,15 +63,11 @@ static jrawMonitorID agent_lock;
6363static void setBP (jvmtiEnv *jvmti_env, JNIEnv *env, jclass klass) {
6464 jmethodID mid;
6565
66- if (!NSK_JNI_VERIFY(env, (mid = NSK_CPP_STUB4(GetMethodID,
67- env, klass, METHODS[0 ], METHOD_SIGS[0 ])) != NULL ))
68- NSK_CPP_STUB2 (FatalError, env,
69- " failed to get ID for the java method\n " );
70-
71- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
72- jvmti_env, mid, 0 )))
73- NSK_CPP_STUB2 (FatalError, env,
74- " failed to set breakpoint\n " );
66+ if (!NSK_JNI_VERIFY(env, (mid = env->GetMethodID (klass, METHODS[0 ], METHOD_SIGS[0 ])) != NULL ))
67+ env->FatalError (" failed to get ID for the java method\n " );
68+
69+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint (mid, 0 )))
70+ env->FatalError (" failed to set breakpoint\n " );
7571}
7672
7773/* * callback functions **/
@@ -82,10 +78,8 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) {
8278 jvmti->RawMonitorEnter (agent_lock);
8379
8480 if (vm_started) {
85- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
86- jvmti_env, klass, &sig, &generic)))
87- NSK_CPP_STUB2 (FatalError, env,
88- " failed to obtain a class signature\n " );
81+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature (klass, &sig, &generic)))
82+ env->FatalError (" failed to obtain a class signature\n " );
8983
9084 if (sig != NULL && (strcmp (sig, CLASS_SIG) == 0 )) {
9185 NSK_DISPLAY1 (
@@ -106,20 +100,16 @@ Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method,
106100 char *sig, *generic;
107101
108102 NSK_DISPLAY0 (" Breakpoint event received\n " );
109- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
110- jvmti_env, method, &klass)))
103+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass (method, &klass)))
111104 NSK_COMPLAIN0 (" TEST FAILURE: unable to get method declaring class\n\n " );
112105
113- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
114- jvmti_env, klass, &sig, &generic)))
115- NSK_CPP_STUB2 (FatalError, env,
116- " Breakpoint: failed to obtain a class signature\n " );
106+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature (klass, &sig, &generic)))
107+ env->FatalError (" Breakpoint: failed to obtain a class signature\n " );
117108
118109 if (sig != NULL && (strcmp (sig, CLASS_SIG) == 0 )) {
119110 NSK_DISPLAY1 (" method declaring class \" %s\"\n\t enabling SingleStep events ...\n " ,
120111 sig);
121- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
122- jvmti_env, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr))) {
112+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr))) {
123113 result = STATUS_FAILED;
124114 NSK_COMPLAIN0 (" TEST FAILURE: cannot enable SingleStep events\n\n " );
125115 }
@@ -142,20 +132,17 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
142132
143133 NSK_DISPLAY0 (" >>>> SingleStep event received\n " );
144134
145- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
146- jvmti_env, method, &methNam, &methSig, NULL ))) {
135+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName (method, &methNam, &methSig, NULL ))) {
147136 result = STATUS_FAILED;
148137 NSK_COMPLAIN0 (" TEST FAILED: unable to get method name during SingleStep callback\n\n " );
149138 return ;
150139 }
151- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
152- jvmti_env, method, &klass))) {
140+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass (method, &klass))) {
153141 result = STATUS_FAILED;
154142 NSK_COMPLAIN0 (" TEST FAILED: unable to get method declaring class during SingleStep callback\n\n " );
155143 return ;
156144 }
157- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
158- jvmti_env, klass, &sig, &generic))) {
145+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature (klass, &sig, &generic))) {
159146 result = STATUS_FAILED;
160147 NSK_COMPLAIN0 (" TEST FAILED: unable to obtain a class signature during SingleStep callback\n\n " );
161148 return ;
@@ -187,21 +174,18 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
187174 " CHECK PASSED: SingleStep event received for the method \" %s\" as expected\n "
188175 " \t disabling the event generation\n " ,
189176 methNam);
190- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
191- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, thread))) {
177+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode (JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, thread))) {
192178 result = STATUS_FAILED;
193179 NSK_COMPLAIN0 (" TEST FAILED: cannot disable SingleStep events\n\n " );
194180 }
195181 }
196182 }
197183
198- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
199- jvmti_env, (unsigned char *) methNam))) {
184+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate ((unsigned char *) methNam))) {
200185 result = STATUS_FAILED;
201186 NSK_COMPLAIN0 (" TEST FAILED: unable to deallocate memory pointed to method name\n\n " );
202187 }
203- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
204- jvmti_env, (unsigned char *) methSig))) {
188+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate ((unsigned char *) methSig))) {
205189 result = STATUS_FAILED;
206190 NSK_COMPLAIN0 (" TEST FAILED: unable to deallocate memory pointed to method signature\n\n " );
207191 }
@@ -261,12 +245,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
261245 memset (&caps, 0 , sizeof (jvmtiCapabilities));
262246 caps.can_generate_breakpoint_events = 1 ;
263247 caps.can_generate_single_step_events = 1 ;
264- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
265- jvmti, &caps)))
248+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities (&caps)))
266249 return JNI_ERR;
267250
268- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
269- jvmti, &caps)))
251+ if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities (&caps)))
270252 return JNI_ERR;
271253
272254 if (!caps.can_generate_single_step_events )
@@ -279,24 +261,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
279261 callbacks.Breakpoint = &Breakpoint;
280262 callbacks.SingleStep = &SingleStep;
281263 callbacks.VMStart = &VMStart;
282- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
283- jvmti, &callbacks, sizeof (callbacks))))
264+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks (&callbacks, sizeof (callbacks))))
284265 return JNI_ERR;
285266
286267 NSK_DISPLAY0 (" setting event callbacks done\n enabling JVMTI events ...\n " );
287- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
288- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL )))
268+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL )))
289269 return JNI_ERR;
290- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
291- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL )))
270+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL )))
292271 return JNI_ERR;
293- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
294- jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL )))
272+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL )))
295273 return JNI_ERR;
296274 NSK_DISPLAY0 (" enabling the events done\n\n " );
297275
298- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
299- jvmti, " agent lock" , &agent_lock)))
276+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor (" agent lock" , &agent_lock)))
300277 return JNI_ERR;
301278
302279 return JNI_OK;
0 commit comments