equal
deleted
inserted
replaced
25 #include <string.h> |
25 #include <string.h> |
26 #include "jvmti.h" |
26 #include "jvmti.h" |
27 #include "agent_common.h" |
27 #include "agent_common.h" |
28 #include "JVMTITools.h" |
28 #include "JVMTITools.h" |
29 |
29 |
30 #ifdef __cplusplus |
|
31 extern "C" { |
30 extern "C" { |
32 #endif |
|
33 |
31 |
34 #ifndef JNI_ENV_ARG |
|
35 |
|
36 #ifdef __cplusplus |
|
37 #define JNI_ENV_ARG(x, y) y |
|
38 #define JNI_ENV_PTR(x) x |
|
39 #else |
|
40 #define JNI_ENV_ARG(x,y) x, y |
|
41 #define JNI_ENV_PTR(x) (*x) |
|
42 #endif |
|
43 |
|
44 #endif |
|
45 |
32 |
46 #define PASSED 0 |
33 #define PASSED 0 |
47 #define STATUS_FAILED 2 |
34 #define STATUS_FAILED 2 |
48 |
35 |
49 static jvmtiEnv *jvmti = NULL; |
36 static jvmtiEnv *jvmti = NULL; |
89 |
76 |
90 if (options != NULL && strcmp(options, "printdump") == 0) { |
77 if (options != NULL && strcmp(options, "printdump") == 0) { |
91 printdump = JNI_TRUE; |
78 printdump = JNI_TRUE; |
92 } |
79 } |
93 |
80 |
94 res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), |
81 res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); |
95 JVMTI_VERSION_1_1); |
|
96 if (res != JNI_OK || jvmti == NULL) { |
82 if (res != JNI_OK || jvmti == NULL) { |
97 printf("Wrong result of a valid call to GetEnv!\n"); |
83 printf("Wrong result of a valid call to GetEnv!\n"); |
98 return JNI_ERR; |
84 return JNI_ERR; |
99 } |
85 } |
100 |
86 |
148 if (!caps.can_generate_method_entry_events || |
134 if (!caps.can_generate_method_entry_events || |
149 !caps.can_generate_method_exit_events) { |
135 !caps.can_generate_method_exit_events) { |
150 return; |
136 return; |
151 } |
137 } |
152 |
138 |
153 mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls), |
139 mid = env->GetStaticMethodID(cls, "emptyMethod", "()V"); |
154 "emptyMethod", "()V"); |
|
155 if (mid == NULL) { |
140 if (mid == NULL) { |
156 printf("Cannot find Method ID for emptyMethod\n"); |
141 printf("Cannot find Method ID for emptyMethod\n"); |
157 result = STATUS_FAILED; |
142 result = STATUS_FAILED; |
158 return; |
143 return; |
159 } |
144 } |
196 result = STATUS_FAILED; |
181 result = STATUS_FAILED; |
197 } |
182 } |
198 return result; |
183 return result; |
199 } |
184 } |
200 |
185 |
201 #ifdef __cplusplus |
|
202 } |
186 } |
203 #endif |
|