1 /*
2 * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 #include <string.h>
25 #include "jvmti.h"
26 #include "agent_common.h"
27 #include "jni_tools.h"
28 #include "jvmti_tools.h"
29 #include "JVMTITools.h"
30
31 extern "C" {
32
33 /* ============================================================================= */
34
35 /* scaffold objects */
36 static jvmtiEnv *jvmti = NULL;
37 static jlong timeout = 0;
38 static jrawMonitorID syncLock = NULL;
39
40 /* constant names */
41 #define STEP_AMOUNT 3
42 #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1)
43
44 static int eventCount[JVMTI_EVENT_COUNT];
45 static int newEventCount[JVMTI_EVENT_COUNT];
46
47 /* ============================================================================= */
48
49 static void
showEventStatistics(int step)50 showEventStatistics(int step /*int *currentCounts*/) {
51 int i;
52 const char* str;
53 int *currentCounts = (step == 1) ? &eventCount[0] : &newEventCount[0];
54
55 NSK_DISPLAY0("\n");
56 NSK_DISPLAY1("Event statistics for %d step:\n", step);
57 NSK_DISPLAY0("-----------------------------\n");
58 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
59 if (currentCounts[i] > 0) {
60 str = TranslateEvent((jvmtiEvent)(i+JVMTI_MIN_EVENT_TYPE_VAL));
61 NSK_DISPLAY2("%-40s %7d\n", str, currentCounts[i]);
62 }
63 }
64 }
65
66 /* ========================================================================== */
67
68 /**
69 * Testcase: check tested events.
70 * - check if expected events received for each method
71 *
72 * Returns NSK_TRUE if test may continue; or NSK_FALSE for test break.
73 */
checkEvents(int step)74 int checkEvents(int step) {
75 int i;
76 jvmtiEvent curr;
77 int result = NSK_TRUE;
78 int *currentCounts;
79 int isExpected = 0;
80
81 int ind_start = JVMTI_EVENT_GARBAGE_COLLECTION_START - JVMTI_MIN_EVENT_TYPE_VAL;
82 int ind_fnsh = JVMTI_EVENT_GARBAGE_COLLECTION_FINISH - JVMTI_MIN_EVENT_TYPE_VAL;
83
84 switch (step) {
85 case 1:
86 currentCounts = &eventCount[0];
87 break;
88
89 case 2:
90 case 3:
91 currentCounts = &newEventCount[0];
92 break;
93
94 default:
95 NSK_COMPLAIN1("Unexpected step no: %d\n", step);
96 return NSK_FALSE;
97 }
98
99 if (currentCounts[ind_start] != currentCounts[ind_fnsh]) {
100
101 NSK_COMPLAIN0("Amounts of events are not equal\n");
102 NSK_COMPLAIN1("\tGARBAGE_COLLECTION_START:\t%6d\n",
103 currentCounts[ind_start]);
104 NSK_COMPLAIN1("\tGARBAGE_COLLECTION_FINISH:\t%6d\n",
105 currentCounts[ind_fnsh]);
106 return NSK_FALSE;
107 }
108
109 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
110
111 curr = (jvmtiEvent) (i + JVMTI_MIN_EVENT_TYPE_VAL);
112
113 switch (step) {
114 case 1:
115 isExpected = ((curr == JVMTI_EVENT_GARBAGE_COLLECTION_START)
116 || (curr == JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)
117 || (curr == JVMTI_EVENT_VM_INIT));
118 break;
119
120 case 2:
121 isExpected = ((curr == JVMTI_EVENT_GARBAGE_COLLECTION_START)
122 || (curr == JVMTI_EVENT_GARBAGE_COLLECTION_FINISH));
123 break;
124
125 case 3:
126 isExpected = (curr == JVMTI_EVENT_VM_DEATH);
127 break;
128 }
129
130 if (isExpected) {
131 if (currentCounts[i] < 1) {
132 NSK_COMPLAIN2("Unexpected events number %7d for %s\n\texpected value must be greater than 1\n",
133 currentCounts[i],
134 TranslateEvent(curr));
135 result = NSK_FALSE;
136 }
137 } else {
138 if (currentCounts[i] > 0) {
139 NSK_COMPLAIN2("Unexpected event %s was sent %d times\n",
140 TranslateEvent(curr),
141 currentCounts[i]);
142 result = NSK_FALSE;
143 }
144 }
145 }
146
147 return result;
148 }
149
150 static void
changeCount(jvmtiEvent event,int * currentCounts)151 changeCount(jvmtiEvent event, int *currentCounts) {
152
153 if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
154 nsk_jvmti_setFailStatus();
155
156 currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
157
158 if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
159 nsk_jvmti_setFailStatus();
160
161 }
162
163 /* ============================================================================= */
164
165 /* callbacks */
166 JNIEXPORT void JNICALL
cbVMInit(jvmtiEnv * jvmti,JNIEnv * jni_env,jthread thread)167 cbVMInit(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread) {
168 changeCount(JVMTI_EVENT_VM_INIT, &eventCount[0]);
169 NSK_DISPLAY0("--->VMINit is received\n");
170 }
171
172 JNIEXPORT void JNICALL
cbVMDeath(jvmtiEnv * jvmti,JNIEnv * jni_env)173 cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) {
174
175 changeCount(JVMTI_EVENT_VM_DEATH, &newEventCount[0]);
176 showEventStatistics(STEP_AMOUNT);
177 if (!checkEvents(STEP_AMOUNT))
178 nsk_jvmti_setFailStatus();
179
180 if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
181 nsk_jvmti_setFailStatus();
182
183 }
184
185 void JNICALL
cbException(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location,jobject exception,jmethodID catch_method,jlocation catch_location)186 cbException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
187 jmethodID method, jlocation location, jobject exception,
188 jmethodID catch_method, jlocation catch_location) {
189 changeCount(JVMTI_EVENT_EXCEPTION, &eventCount[0]);
190 }
191
192 void JNICALL
cbExceptionCatch(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location,jobject exception)193 cbExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
194 jmethodID method, jlocation location, jobject exception) {
195 changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &eventCount[0]);
196 }
197
198 void JNICALL
cbSingleStep(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location)199 cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
200 jmethodID method, jlocation location) {
201 changeCount(JVMTI_EVENT_SINGLE_STEP, &eventCount[0]);
202 }
203
204 void JNICALL
cbFramePop(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jboolean was_popped_by_exception)205 cbFramePop(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
206 jmethodID method, jboolean was_popped_by_exception) {
207 changeCount(JVMTI_EVENT_FRAME_POP, &eventCount[0]);
208 }
209
210 void JNICALL
cbBreakpoint(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location)211 cbBreakpoint(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
212 jmethodID method, jlocation location) {
213 changeCount(JVMTI_EVENT_BREAKPOINT, &eventCount[0]);
214 }
215
216 void JNICALL
cbFieldAccess(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location,jclass field_klass,jobject object,jfieldID field)217 cbFieldAccess(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
218 jmethodID method, jlocation location, jclass field_klass,
219 jobject object, jfieldID field) {
220 changeCount(JVMTI_EVENT_FIELD_ACCESS, &eventCount[0]);
221 }
222
223 void JNICALL
cbFieldModification(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jlocation location,jclass field_klass,jobject object,jfieldID field,char signature_type,jvalue new_value)224 cbFieldModification(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
225 jmethodID method, jlocation location, jclass field_klass,
226 jobject object, jfieldID field, char signature_type,
227 jvalue new_value) {
228 changeCount(JVMTI_EVENT_FIELD_MODIFICATION, &eventCount[0]);
229 }
230
231 void JNICALL
cbMethodEntry(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method)232 cbMethodEntry(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
233 jmethodID method) {
234 changeCount(JVMTI_EVENT_METHOD_ENTRY, &eventCount[0]);
235 }
236
237 void JNICALL
cbMethodExit(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,jboolean was_popped_by_exception,jvalue return_value)238 cbMethodExit(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
239 jmethodID method, jboolean was_popped_by_exception,
240 jvalue return_value) {
241 changeCount(JVMTI_EVENT_METHOD_EXIT, &eventCount[0]);
242 }
243
244 void JNICALL
cbNativeMethodBind(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jmethodID method,void * address,void ** new_address_ptr)245 cbNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread,
246 jmethodID method, void* address, void** new_address_ptr) {
247 changeCount(JVMTI_EVENT_NATIVE_METHOD_BIND, &eventCount[0]);
248 }
249
250 void JNICALL
cbCompiledMethodLoad(jvmtiEnv * jvmti_env,jmethodID method,jint code_size,const void * code_addr,jint map_length,const jvmtiAddrLocationMap * map,const void * compile_info)251 cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size,
252 const void* code_addr, jint map_length,
253 const jvmtiAddrLocationMap* map, const void* compile_info) {
254 changeCount(JVMTI_EVENT_COMPILED_METHOD_LOAD, &eventCount[0]);
255 }
256
257 void JNICALL
cbCompiledMethodUnload(jvmtiEnv * jvmti_env,jmethodID method,const void * code_addr)258 cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method,
259 const void* code_addr) {
260 changeCount(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, &eventCount[0]);
261 }
262
263 void JNICALL
cbMonitorWait(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jobject object,jlong tout)264 cbMonitorWait(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
265 jobject object, jlong tout) {
266
267 changeCount(JVMTI_EVENT_MONITOR_WAIT, &eventCount[0]);
268 }
269
270 void JNICALL
cbMonitorWaited(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jobject object,jboolean timed_out)271 cbMonitorWaited(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
272 jobject object, jboolean timed_out) {
273
274 changeCount(JVMTI_EVENT_MONITOR_WAITED, &eventCount[0]);
275 }
276
277 JNIEXPORT void JNICALL
cbMonitorContendedEnter(jvmtiEnv * jvmti,JNIEnv * jni_env,jthread thread,jobject object)278 cbMonitorContendedEnter(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread,
279 jobject object) {
280
281 changeCount(JVMTI_EVENT_MONITOR_CONTENDED_ENTER, &eventCount[0]);
282 }
283
284 void JNICALL
cbMonitorContendedEntered(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jobject object)285 cbMonitorContendedEntered(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
286 jobject object) {
287
288 changeCount(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, &eventCount[0]);
289 }
290
291 void
handlerMC1(jvmtiEvent event)292 handlerMC1(jvmtiEvent event) {
293
294 changeCount(event, &eventCount[0]);
295 }
296
297 void JNICALL
cbGarbageCollectionStart(jvmtiEnv * jvmti_env)298 cbGarbageCollectionStart(jvmtiEnv *jvmti_env) {
299
300 handlerMC1(JVMTI_EVENT_GARBAGE_COLLECTION_START);
301 }
302
303 void JNICALL
cbGarbageCollectionFinish(jvmtiEnv * jvmti_env)304 cbGarbageCollectionFinish(jvmtiEnv *jvmti_env) {
305
306 handlerMC1(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH);
307 }
308
309 void JNICALL
cbObjectFree(jvmtiEnv * jvmti_env,jlong tag)310 cbObjectFree(jvmtiEnv *jvmti_env, jlong tag) {
311 changeCount(JVMTI_EVENT_OBJECT_FREE, &eventCount[0]);
312 }
313
314 void JNICALL
cbVMObjectAlloc(jvmtiEnv * jvmti_env,JNIEnv * jni_env,jthread thread,jobject object,jclass object_klass,jlong size)315 cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread,
316 jobject object, jclass object_klass, jlong size) {
317
318 changeCount(JVMTI_EVENT_VM_OBJECT_ALLOC, &eventCount[0]);
319 }
320
321 void
handlerMC2(jvmtiEvent event)322 handlerMC2(jvmtiEvent event) {
323
324 changeCount(event, &newEventCount[0]);
325 }
326
327 void JNICALL
cbNewGarbageCollectionStart(jvmtiEnv * jvmti_env)328 cbNewGarbageCollectionStart(jvmtiEnv *jvmti_env) {
329
330 handlerMC2(JVMTI_EVENT_GARBAGE_COLLECTION_START);
331 }
332
333 void JNICALL
cbNewGarbageCollectionFinish(jvmtiEnv * jvmti_env)334 cbNewGarbageCollectionFinish(jvmtiEnv *jvmti_env) {
335
336 handlerMC2(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH);
337 }
338
339 /* ============================================================================= */
340
enableEvent(jvmtiEvent event)341 static int enableEvent(jvmtiEvent event) {
342
343 if (nsk_jvmti_isOptionalEvent(event)
344 && (event != JVMTI_EVENT_GARBAGE_COLLECTION_START)
345 && (event != JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) {
346 if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
347 jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
348 NSK_COMPLAIN1("Unexpected error enabling %s\n",
349 TranslateEvent(event));
350 return NSK_FALSE;
351 }
352 } else {
353 if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
354 NSK_COMPLAIN1("Unexpected error enabling %s\n",
355 TranslateEvent(event));
356 return NSK_FALSE;
357 }
358 }
359
360 return NSK_TRUE;
361 }
362
enableEventList()363 static int enableEventList() {
364 int i;
365 int result = NSK_TRUE;
366
367 NSK_DISPLAY0("Enable events\n");
368
369 result = enableEvent(JVMTI_EVENT_VM_INIT);
370
371 result = result && enableEvent(JVMTI_EVENT_VM_DEATH);
372
373 /* enabling optional events */
374 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
375 jvmtiEvent event = (jvmtiEvent)(i+JVMTI_MIN_EVENT_TYPE_VAL);
376
377 if (nsk_jvmti_isOptionalEvent(event))
378 result = result && enableEvent(event);
379 }
380
381 if (result == NSK_FALSE) {
382 nsk_jvmti_setFailStatus();
383 return NSK_FALSE;
384 }
385
386 return NSK_TRUE;
387 }
388
389 /* ============================================================================= */
390
391 static int
setCallBacks(int step)392 setCallBacks(int step) {
393
394 int i;
395
396 jvmtiEventCallbacks eventCallbacks;
397 memset(&eventCallbacks, 0, sizeof(eventCallbacks));
398
399 NSK_DISPLAY0("\n");
400 NSK_DISPLAY1("===============step %d===============\n", step);
401 NSK_DISPLAY0("\n");
402 switch (step) {
403 case 1:
404 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
405 eventCount[i] = 0;
406 }
407
408 eventCallbacks.VMInit = cbVMInit;
409 eventCallbacks.Exception = cbException;
410 eventCallbacks.ExceptionCatch = cbExceptionCatch;
411 eventCallbacks.SingleStep = cbSingleStep;
412 eventCallbacks.FramePop = cbFramePop;
413 eventCallbacks.Breakpoint = cbBreakpoint;
414 eventCallbacks.FieldAccess = cbFieldAccess;
415 eventCallbacks.FieldModification = cbFieldModification;
416 eventCallbacks.MethodEntry = cbMethodEntry;
417 eventCallbacks.MethodExit = cbMethodExit;
418 eventCallbacks.NativeMethodBind = cbNativeMethodBind;
419 eventCallbacks.CompiledMethodLoad = cbCompiledMethodLoad;
420 eventCallbacks.CompiledMethodUnload = cbCompiledMethodUnload;
421 eventCallbacks.MonitorWait = cbMonitorWait;
422 eventCallbacks.MonitorWaited = cbMonitorWaited;
423 eventCallbacks.MonitorContendedEnter = cbMonitorContendedEnter;
424 eventCallbacks.MonitorContendedEntered = cbMonitorContendedEntered;
425 eventCallbacks.GarbageCollectionStart = cbGarbageCollectionStart;
426 eventCallbacks.GarbageCollectionFinish = cbGarbageCollectionFinish;
427 eventCallbacks.ObjectFree = cbObjectFree;
428 eventCallbacks.VMObjectAlloc = cbVMObjectAlloc;
429 break;
430
431 case 2:
432 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
433 newEventCount[i] = 0;
434 }
435
436 eventCallbacks.GarbageCollectionStart = cbNewGarbageCollectionStart;
437 eventCallbacks.GarbageCollectionFinish = cbNewGarbageCollectionFinish;
438 break;
439
440 case 3:
441 for (i = 0; i < JVMTI_EVENT_COUNT; i++) {
442 newEventCount[i] = 0;
443 }
444
445 eventCallbacks.VMDeath = cbVMDeath;
446 break;
447
448 }
449 if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
450 return NSK_FALSE;
451
452 return NSK_TRUE;
453 }
454
455 /* ============================================================================= */
456
457 /** Agent algorithm. */
458 static void JNICALL
agentProc(jvmtiEnv * jvmti,JNIEnv * agentJNI,void * arg)459 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
460
461 int i;
462
463 for (i = 1; i <= STEP_AMOUNT; i++) {
464 if (i > 1) {
465 NSK_DISPLAY0("Check received events\n");
466
467 showEventStatistics(i-1);
468 if (!checkEvents(i-1))
469 nsk_jvmti_setFailStatus();
470
471 if (!setCallBacks(i)) {
472 return;
473 }
474
475 if (!nsk_jvmti_resumeSync())
476 return;
477 }
478
479 NSK_DISPLAY0("Wait for debuggee to become ready\n");
480 if (!nsk_jvmti_waitForSync(timeout))
481 return;
482
483 }
484
485 NSK_DISPLAY0("Let debuggee to finish\n");
486 if (!nsk_jvmti_resumeSync())
487 return;
488
489 }
490
491 /* ============================================================================= */
492
493 /** Agent library initialization. */
494 #ifdef STATIC_BUILD
Agent_OnLoad_em02t002(JavaVM * jvm,char * options,void * reserved)495 JNIEXPORT jint JNICALL Agent_OnLoad_em02t002(JavaVM *jvm, char *options, void *reserved) {
496 return Agent_Initialize(jvm, options, reserved);
497 }
Agent_OnAttach_em02t002(JavaVM * jvm,char * options,void * reserved)498 JNIEXPORT jint JNICALL Agent_OnAttach_em02t002(JavaVM *jvm, char *options, void *reserved) {
499 return Agent_Initialize(jvm, options, reserved);
500 }
JNI_OnLoad_em02t002(JavaVM * jvm,char * options,void * reserved)501 JNIEXPORT jint JNI_OnLoad_em02t002(JavaVM *jvm, char *options, void *reserved) {
502 return JNI_VERSION_1_8;
503 }
504 #endif
Agent_Initialize(JavaVM * jvm,char * options,void * reserved)505 jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) {
506
507 if (!NSK_VERIFY(nsk_jvmti_parseOptions(options)))
508 return JNI_ERR;
509
510 timeout = nsk_jvmti_getWaitTime() * 60 * 1000;
511
512 jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved);
513 if (!NSK_VERIFY(jvmti != NULL))
514 return JNI_ERR;
515
516 if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
517 nsk_jvmti_setFailStatus();
518 return JNI_ERR;
519 }
520
521 {
522 jvmtiCapabilities caps;
523 memset(&caps, 0, sizeof(caps));
524
525 caps.can_generate_garbage_collection_events = 1;
526 if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
527 return JNI_ERR;
528 }
529
530 if (!setCallBacks(1)) {
531 return JNI_ERR;
532 }
533
534 nsk_jvmti_showPossessedCapabilities(jvmti);
535
536 if (!enableEventList()) {
537 return JNI_ERR;
538 }
539
540 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
541 return JNI_ERR;
542
543 return JNI_OK;
544 }
545
546 /* ============================================================================= */
547
548
549 }
550