test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp
equal
deleted
inserted
replaced
40 jvmti_env->GetClassSignature(klass, &className, &generic); |
40 jvmti_env->GetClassSignature(klass, &className, &generic); |
41 if (strcmp(className,CLASS_NAME) == 0) { |
41 if (strcmp(className,CLASS_NAME) == 0) { |
42 char fileName[512]; |
42 char fileName[512]; |
43 nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, |
43 nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, |
44 sizeof(fileName)/sizeof(char)); |
44 sizeof(fileName)/sizeof(char)); |
45 nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL ); |
45 nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); |
46 if ( nsk_jvmti_redefineClass(jvmti_env, klass,fileName) == NSK_TRUE ) { |
46 if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName) == NSK_TRUE) { |
47 nsk_printf("Redefine successful ..\n"); |
47 nsk_printf("Redefine successful ..\n"); |
48 } else { |
48 } else { |
49 nsk_printf("# error :: Redefine failed..\n"); |
49 nsk_printf("# error :: Redefine failed..\n"); |
50 } |
50 } |
51 } |
51 } |
65 jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { |
65 jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { |
66 jint rc ; |
66 jint rc ; |
67 jvmtiEnv * jvmti; |
67 jvmtiEnv * jvmti; |
68 nsk_printf("Agent:: VM.. Started..\n"); |
68 nsk_printf("Agent:: VM.. Started..\n"); |
69 rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1); |
69 rc=vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1); |
70 if ( rc!= JNI_OK ) { |
70 if (rc!= JNI_OK) { |
71 nsk_printf("Agent:: Could not load JVMTI interface \n"); |
71 nsk_printf("Agent:: Could not load JVMTI interface \n"); |
72 return JNI_ERR; |
72 return JNI_ERR; |
73 } else { |
73 } else { |
74 jvmtiCapabilities caps; |
74 jvmtiCapabilities caps; |
75 jvmtiEventCallbacks eventCallbacks; |
75 jvmtiEventCallbacks eventCallbacks; |
76 if (nsk_jvmti_parseOptions(options) == NSK_FALSE ) { |
76 if (nsk_jvmti_parseOptions(options) == NSK_FALSE) { |
77 nsk_printf("# error agent Failed to parse options \n"); |
77 nsk_printf("# error agent Failed to parse options \n"); |
78 return JNI_ERR; |
78 return JNI_ERR; |
79 } |
79 } |
80 memset(&caps, 0, sizeof(caps)); |
80 memset(&caps, 0, sizeof(caps)); |
81 caps.can_redefine_classes = 1; |
81 caps.can_redefine_classes = 1; |
86 rc=jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)); |
86 rc=jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)); |
87 if (rc != JVMTI_ERROR_NONE) { |
87 if (rc != JVMTI_ERROR_NONE) { |
88 nsk_printf(" Agent:: Error occured while setting event call back \n"); |
88 nsk_printf(" Agent:: Error occured while setting event call back \n"); |
89 return JNI_ERR; |
89 return JNI_ERR; |
90 } |
90 } |
91 if ( nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL) == NSK_TRUE ) { |
91 if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL) == NSK_TRUE) { |
92 nsk_printf(" Enabled. noftification.."); |
92 nsk_printf(" Enabled. noftification.."); |
93 } else { |
93 } else { |
94 nsk_printf(" Failed to Enable .."); |
94 nsk_printf(" Failed to Enable .."); |
95 } |
95 } |
96 } |
96 } |