|
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 #ifdef __cplusplus |
|
32 extern "C" { |
|
33 #endif |
|
34 |
|
35 /* ============================================================================= */ |
|
36 |
|
37 /* scaffold objects */ |
|
38 static jvmtiEnv *jvmti = NULL; |
|
39 static jthread testedThread; |
|
40 static jlong timeout = 0; |
|
41 static jrawMonitorID syncLock = NULL; |
|
42 |
|
43 /* constant names */ |
|
44 #define STEP_NUMBER 3 |
|
45 #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) |
|
46 #define NUMBER_OF_INVOCATIONS 1000 |
|
47 |
|
48 static int eventCount[JVMTI_EVENT_COUNT]; |
|
49 static int newEventCount[JVMTI_EVENT_COUNT]; |
|
50 |
|
51 /* ============================================================================= */ |
|
52 JNIEXPORT void JNICALL |
|
53 Java_nsk_jvmti_scenarios_events_EM02_em02t012_setThread(JNIEnv *jni_env, |
|
54 jobject o, jthread thrd) { |
|
55 |
|
56 /* make thread accessable for a long time */ |
|
57 NSK_JNI_VERIFY(jni_env, (testedThread = |
|
58 NSK_CPP_STUB2(NewGlobalRef, jni_env, thrd)) != NULL); |
|
59 } |
|
60 |
|
61 static void |
|
62 showEventStatistics(int step) { |
|
63 int i; |
|
64 const char* str; |
|
65 int *currentCounts = (step == 1) ? &eventCount[0] : &newEventCount[0]; |
|
66 |
|
67 NSK_DISPLAY0("\n"); |
|
68 NSK_DISPLAY1("Event statistics for %d step:\n", step); |
|
69 NSK_DISPLAY0("-----------------------------\n"); |
|
70 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
71 if (currentCounts[i] > 0) { |
|
72 str = TranslateEvent((jvmtiEvent)(i+JVMTI_MIN_EVENT_TYPE_VAL)); |
|
73 NSK_DISPLAY2("%-40s %7d\n", str, currentCounts[i]); |
|
74 } |
|
75 } |
|
76 } |
|
77 |
|
78 /* ========================================================================== */ |
|
79 |
|
80 int checkEvents(int step) { |
|
81 int i; |
|
82 jvmtiEvent curr; |
|
83 int result = NSK_TRUE; |
|
84 int *currentCounts; |
|
85 int isExpected = 0; |
|
86 |
|
87 switch (step) { |
|
88 case 1: |
|
89 currentCounts = &eventCount[0]; |
|
90 break; |
|
91 |
|
92 case 2: |
|
93 case 3: |
|
94 currentCounts = &newEventCount[0]; |
|
95 break; |
|
96 |
|
97 default: |
|
98 NSK_COMPLAIN1("Unexpected step no: %d\n", step); |
|
99 return NSK_FALSE; |
|
100 } |
|
101 |
|
102 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
103 |
|
104 curr = (jvmtiEvent) (i + JVMTI_MIN_EVENT_TYPE_VAL); |
|
105 |
|
106 switch (step) { |
|
107 case 1: |
|
108 isExpected = ((curr == JVMTI_EVENT_VM_INIT) |
|
109 || (curr == JVMTI_EVENT_FRAME_POP)); |
|
110 break; |
|
111 |
|
112 case 2: |
|
113 isExpected = (curr == JVMTI_EVENT_FRAME_POP); |
|
114 break; |
|
115 |
|
116 case 3: |
|
117 isExpected = (curr == JVMTI_EVENT_VM_DEATH); |
|
118 break; |
|
119 } |
|
120 |
|
121 if (isExpected) { |
|
122 if (curr == JVMTI_EVENT_FRAME_POP) { |
|
123 if (currentCounts[i] != NUMBER_OF_INVOCATIONS) { |
|
124 NSK_COMPLAIN3("Unexpected number of %s events %d, expected value is %d\n", |
|
125 TranslateEvent(curr), |
|
126 currentCounts[i], |
|
127 NUMBER_OF_INVOCATIONS); |
|
128 result = NSK_FALSE; |
|
129 } |
|
130 } else { |
|
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 } |
|
138 |
|
139 } else { |
|
140 |
|
141 if (currentCounts[i] > 0) { |
|
142 NSK_COMPLAIN2("Unexpected event %s was sent %d times\n", |
|
143 TranslateEvent(curr), |
|
144 currentCounts[i]); |
|
145 result = NSK_FALSE; |
|
146 } |
|
147 } |
|
148 } |
|
149 |
|
150 return result; |
|
151 } |
|
152 |
|
153 static void |
|
154 changeCount(jvmtiEvent event, int *currentCounts) { |
|
155 |
|
156 if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock))) |
|
157 nsk_jvmti_setFailStatus(); |
|
158 |
|
159 currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++; |
|
160 |
|
161 if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock))) |
|
162 nsk_jvmti_setFailStatus(); |
|
163 |
|
164 } |
|
165 |
|
166 /* ============================================================================= */ |
|
167 |
|
168 /* callbacks */ |
|
169 JNIEXPORT void JNICALL |
|
170 cbVMInit(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread) { |
|
171 changeCount(JVMTI_EVENT_VM_INIT, &eventCount[0]); |
|
172 } |
|
173 |
|
174 JNIEXPORT void JNICALL |
|
175 cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) { |
|
176 changeCount(JVMTI_EVENT_VM_DEATH, &newEventCount[0]); |
|
177 showEventStatistics(STEP_NUMBER); |
|
178 if (!checkEvents(STEP_NUMBER)) |
|
179 nsk_jvmti_setFailStatus(); |
|
180 |
|
181 if (!NSK_JVMTI_VERIFY( |
|
182 NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock))) |
|
183 nsk_jvmti_setFailStatus(); |
|
184 |
|
185 } |
|
186 |
|
187 void JNICALL |
|
188 cbException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
189 jmethodID method, jlocation location, jobject exception, |
|
190 jmethodID catch_method, jlocation catch_location) { |
|
191 |
|
192 changeCount(JVMTI_EVENT_EXCEPTION, &eventCount[0]); |
|
193 } |
|
194 |
|
195 void JNICALL |
|
196 cbExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
197 jmethodID method, jlocation location, jobject exception) { |
|
198 |
|
199 changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &eventCount[0]); |
|
200 } |
|
201 |
|
202 void JNICALL |
|
203 cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
204 jmethodID method, jlocation location) { |
|
205 |
|
206 changeCount(JVMTI_EVENT_SINGLE_STEP, &eventCount[0]); |
|
207 } |
|
208 |
|
209 void JNICALL |
|
210 cbFramePop(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
211 jmethodID method, jboolean was_popped_by_exception) { |
|
212 changeCount(JVMTI_EVENT_FRAME_POP, &eventCount[0]); |
|
213 } |
|
214 |
|
215 void JNICALL |
|
216 cbNewFramePop(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
217 jmethodID method, jboolean was_popped_by_exception) { |
|
218 changeCount(JVMTI_EVENT_FRAME_POP, &newEventCount[0]); |
|
219 } |
|
220 |
|
221 void JNICALL |
|
222 cbBreakpoint(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
223 jmethodID method, jlocation location) { |
|
224 changeCount(JVMTI_EVENT_BREAKPOINT, &eventCount[0]); |
|
225 } |
|
226 |
|
227 void JNICALL |
|
228 cbFieldAccess(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
229 jmethodID method, jlocation location, jclass field_klass, |
|
230 jobject object, jfieldID field) { |
|
231 |
|
232 changeCount(JVMTI_EVENT_FIELD_ACCESS, &eventCount[0]); |
|
233 } |
|
234 |
|
235 void JNICALL |
|
236 cbFieldModification(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
237 jmethodID method, jlocation location, jclass field_klass, |
|
238 jobject object, jfieldID field, char signature_type, |
|
239 jvalue new_value) { |
|
240 |
|
241 changeCount(JVMTI_EVENT_FIELD_MODIFICATION, &eventCount[0]); |
|
242 } |
|
243 |
|
244 void JNICALL |
|
245 cbMethodEntry(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
246 jmethodID method) { |
|
247 |
|
248 changeCount(JVMTI_EVENT_METHOD_ENTRY, &eventCount[0]); |
|
249 } |
|
250 |
|
251 void JNICALL |
|
252 cbMethodExit(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
253 jmethodID method, jboolean was_popped_by_exception, |
|
254 jvalue return_value) { |
|
255 |
|
256 changeCount(JVMTI_EVENT_METHOD_EXIT, &eventCount[0]); |
|
257 } |
|
258 |
|
259 void JNICALL |
|
260 cbNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread, |
|
261 jmethodID method, void* address, void** new_address_ptr) { |
|
262 changeCount(JVMTI_EVENT_NATIVE_METHOD_BIND, &eventCount[0]); |
|
263 } |
|
264 |
|
265 void JNICALL |
|
266 cbMonitorWait(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
267 jobject object, jlong tout) { |
|
268 |
|
269 changeCount(JVMTI_EVENT_MONITOR_WAIT, &eventCount[0]); |
|
270 } |
|
271 |
|
272 void JNICALL |
|
273 cbMonitorWaited(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
274 jobject object, jboolean timed_out) { |
|
275 |
|
276 changeCount(JVMTI_EVENT_MONITOR_WAITED, &eventCount[0]); |
|
277 } |
|
278 |
|
279 JNIEXPORT void JNICALL |
|
280 cbMonitorContendedEnter(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, |
|
281 jobject object) { |
|
282 |
|
283 changeCount(JVMTI_EVENT_MONITOR_CONTENDED_ENTER, &eventCount[0]); |
|
284 } |
|
285 |
|
286 void JNICALL |
|
287 cbMonitorContendedEntered(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
288 jobject object) { |
|
289 |
|
290 changeCount(JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, &eventCount[0]); |
|
291 } |
|
292 |
|
293 void JNICALL |
|
294 cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, |
|
295 const void* code_addr, jint map_length, |
|
296 const jvmtiAddrLocationMap* map, const void* compile_info) { |
|
297 changeCount(JVMTI_EVENT_COMPILED_METHOD_LOAD, &eventCount[0]); |
|
298 } |
|
299 |
|
300 void JNICALL |
|
301 cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, |
|
302 const void* code_addr) { |
|
303 changeCount(JVMTI_EVENT_COMPILED_METHOD_UNLOAD, &eventCount[0]); |
|
304 } |
|
305 |
|
306 void JNICALL |
|
307 cbGarbageCollectionStart(jvmtiEnv *jvmti_env) { |
|
308 changeCount(JVMTI_EVENT_GARBAGE_COLLECTION_START, &eventCount[0]); |
|
309 } |
|
310 |
|
311 void JNICALL |
|
312 cbGarbageCollectionFinish(jvmtiEnv *jvmti_env) { |
|
313 changeCount(JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, &eventCount[0]); |
|
314 } |
|
315 |
|
316 void JNICALL |
|
317 cbObjectFree(jvmtiEnv *jvmti_env, jlong tag) { |
|
318 |
|
319 changeCount(JVMTI_EVENT_OBJECT_FREE, &eventCount[0]); |
|
320 } |
|
321 |
|
322 void JNICALL |
|
323 cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, |
|
324 jobject object, jclass object_klass, jlong size) { |
|
325 |
|
326 changeCount(JVMTI_EVENT_VM_OBJECT_ALLOC, &eventCount[0]); |
|
327 } |
|
328 |
|
329 /* ============================================================================= */ |
|
330 |
|
331 static int enableEvent(jvmtiEvent event) { |
|
332 |
|
333 if (nsk_jvmti_isOptionalEvent(event) |
|
334 && (event != JVMTI_EVENT_FRAME_POP)) { |
|
335 if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, |
|
336 NSK_CPP_STUB4(SetEventNotificationMode, jvmti, |
|
337 JVMTI_ENABLE, event, NULL))) { |
|
338 NSK_COMPLAIN1("Unexpected error enabling %s\n", |
|
339 TranslateEvent(event)); |
|
340 return NSK_FALSE; |
|
341 } |
|
342 } else { |
|
343 if (!NSK_JVMTI_VERIFY( |
|
344 NSK_CPP_STUB4(SetEventNotificationMode, jvmti, |
|
345 JVMTI_ENABLE, event, NULL))) { |
|
346 NSK_COMPLAIN1("Unexpected error enabling %s\n", |
|
347 TranslateEvent(event)); |
|
348 return NSK_FALSE; |
|
349 } |
|
350 } |
|
351 |
|
352 return NSK_TRUE; |
|
353 } |
|
354 |
|
355 /** |
|
356 * Enable or disable tested events. |
|
357 */ |
|
358 static int enableEventList() { |
|
359 |
|
360 int i, result; |
|
361 |
|
362 result = enableEvent(JVMTI_EVENT_VM_INIT); |
|
363 |
|
364 result = result && enableEvent(JVMTI_EVENT_VM_DEATH); |
|
365 |
|
366 /* enabling optional events */ |
|
367 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
368 jvmtiEvent event = (jvmtiEvent)(i+JVMTI_MIN_EVENT_TYPE_VAL); |
|
369 |
|
370 if (nsk_jvmti_isOptionalEvent(event)) |
|
371 result = result && enableEvent(event); |
|
372 } |
|
373 |
|
374 if (result == NSK_FALSE) { |
|
375 nsk_jvmti_setFailStatus(); |
|
376 return NSK_FALSE; |
|
377 } |
|
378 |
|
379 return NSK_TRUE; |
|
380 } |
|
381 |
|
382 /* ============================================================================= */ |
|
383 |
|
384 static int |
|
385 setCallBacks(int step) { |
|
386 |
|
387 int i; |
|
388 |
|
389 jvmtiEventCallbacks eventCallbacks; |
|
390 memset(&eventCallbacks, 0, sizeof(eventCallbacks)); |
|
391 |
|
392 switch (step) { |
|
393 case 1: |
|
394 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
395 eventCount[i] = 0; |
|
396 } |
|
397 |
|
398 eventCallbacks.VMInit = cbVMInit; |
|
399 eventCallbacks.Exception = cbException; |
|
400 eventCallbacks.ExceptionCatch = cbExceptionCatch; |
|
401 eventCallbacks.SingleStep = cbSingleStep; |
|
402 eventCallbacks.FramePop = cbFramePop; |
|
403 eventCallbacks.Breakpoint = cbBreakpoint; |
|
404 eventCallbacks.FieldAccess = cbFieldAccess; |
|
405 eventCallbacks.FieldModification = cbFieldModification; |
|
406 eventCallbacks.MethodEntry = cbMethodEntry; |
|
407 eventCallbacks.MethodExit = cbMethodExit; |
|
408 eventCallbacks.NativeMethodBind = cbNativeMethodBind; |
|
409 eventCallbacks.CompiledMethodLoad = cbCompiledMethodLoad; |
|
410 eventCallbacks.CompiledMethodUnload = cbCompiledMethodUnload; |
|
411 eventCallbacks.MonitorWait = cbMonitorWait; |
|
412 eventCallbacks.MonitorWaited = cbMonitorWaited; |
|
413 eventCallbacks.MonitorContendedEnter = cbMonitorContendedEnter; |
|
414 eventCallbacks.MonitorContendedEntered = cbMonitorContendedEntered; |
|
415 eventCallbacks.GarbageCollectionStart = cbGarbageCollectionStart; |
|
416 eventCallbacks.GarbageCollectionFinish = cbGarbageCollectionFinish; |
|
417 eventCallbacks.ObjectFree = cbObjectFree; |
|
418 eventCallbacks.VMObjectAlloc = cbVMObjectAlloc; |
|
419 break; |
|
420 |
|
421 case 2: |
|
422 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
423 newEventCount[i] = 0; |
|
424 } |
|
425 |
|
426 eventCallbacks.FramePop = cbNewFramePop; |
|
427 break; |
|
428 |
|
429 case 3: |
|
430 for (i = 0; i < JVMTI_EVENT_COUNT; i++) { |
|
431 newEventCount[i] = 0; |
|
432 } |
|
433 |
|
434 eventCallbacks.VMDeath = cbVMDeath; |
|
435 break; |
|
436 |
|
437 } |
|
438 if (!NSK_JVMTI_VERIFY( |
|
439 NSK_CPP_STUB3(SetEventCallbacks, jvmti, |
|
440 &eventCallbacks, |
|
441 sizeof(eventCallbacks)))) |
|
442 return NSK_FALSE; |
|
443 |
|
444 return NSK_TRUE; |
|
445 } |
|
446 |
|
447 /* ============================================================================= */ |
|
448 |
|
449 /** Agent algorithm. */ |
|
450 static void JNICALL |
|
451 agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { |
|
452 |
|
453 int i, j; |
|
454 |
|
455 for (i = 1; i <= STEP_NUMBER; i++) { |
|
456 |
|
457 if (!nsk_jvmti_waitForSync(timeout)) |
|
458 return; |
|
459 |
|
460 if (!NSK_JVMTI_VERIFY( |
|
461 NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) |
|
462 return; |
|
463 |
|
464 for (j = 2; j < 1002; j++) { |
|
465 if (!NSK_JVMTI_VERIFY( |
|
466 NSK_CPP_STUB3(NotifyFramePop, jvmti, testedThread, j))) |
|
467 return; |
|
468 } |
|
469 |
|
470 if (!NSK_JVMTI_VERIFY( |
|
471 NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) |
|
472 return; |
|
473 |
|
474 if (!nsk_jvmti_resumeSync()) |
|
475 return; |
|
476 |
|
477 if (!nsk_jvmti_waitForSync(timeout)) |
|
478 return; |
|
479 |
|
480 if (i < STEP_NUMBER) { |
|
481 showEventStatistics(i); |
|
482 if (!checkEvents(i)) |
|
483 nsk_jvmti_setFailStatus(); |
|
484 |
|
485 if (!setCallBacks(i + 1)) { |
|
486 return; |
|
487 } |
|
488 } |
|
489 |
|
490 if (!nsk_jvmti_resumeSync()) |
|
491 return; |
|
492 } |
|
493 |
|
494 NSK_CPP_STUB2(DeleteGlobalRef, agentJNI, testedThread); |
|
495 } |
|
496 |
|
497 /* ============================================================================= */ |
|
498 |
|
499 /** Agent library initialization. */ |
|
500 #ifdef STATIC_BUILD |
|
501 JNIEXPORT jint JNICALL Agent_OnLoad_em02t012(JavaVM *jvm, char *options, void *reserved) { |
|
502 return Agent_Initialize(jvm, options, reserved); |
|
503 } |
|
504 JNIEXPORT jint JNICALL Agent_OnAttach_em02t012(JavaVM *jvm, char *options, void *reserved) { |
|
505 return Agent_Initialize(jvm, options, reserved); |
|
506 } |
|
507 JNIEXPORT jint JNI_OnLoad_em02t012(JavaVM *jvm, char *options, void *reserved) { |
|
508 return JNI_VERSION_1_8; |
|
509 } |
|
510 #endif |
|
511 jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { |
|
512 |
|
513 if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) |
|
514 return JNI_ERR; |
|
515 |
|
516 timeout = nsk_jvmti_getWaitTime() * 60 * 1000; |
|
517 |
|
518 if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) |
|
519 return JNI_ERR; |
|
520 |
|
521 if (!NSK_JVMTI_VERIFY( |
|
522 NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) { |
|
523 nsk_jvmti_setFailStatus(); |
|
524 return JNI_ERR; |
|
525 } |
|
526 |
|
527 { |
|
528 jvmtiCapabilities caps; |
|
529 memset(&caps, 0, sizeof(caps)); |
|
530 |
|
531 caps.can_suspend = 1; |
|
532 caps.can_generate_frame_pop_events = 1; |
|
533 if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) |
|
534 return JNI_ERR; |
|
535 } |
|
536 |
|
537 if (!setCallBacks(1)) { |
|
538 return JNI_ERR; |
|
539 } |
|
540 |
|
541 if (!enableEventList()) { |
|
542 return JNI_ERR; |
|
543 } |
|
544 |
|
545 if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) |
|
546 return JNI_ERR; |
|
547 |
|
548 return JNI_OK; |
|
549 } |
|
550 |
|
551 /* ============================================================================= */ |
|
552 |
|
553 #ifdef __cplusplus |
|
554 } |
|
555 #endif |