natevents.cc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579
  1. #include <gcj/cni.h>
  2. #include <jvm.h>
  3. #include <jvmti.h>
  4. #include <stdio.h>
  5. #include "jvmti-int.h"
  6. #include "events.h"
  7. void
  8. print_events ()
  9. {
  10. #define DO(X) \
  11. do \
  12. { \
  13. if (JVMTI_REQUESTED_EVENT (X)) \
  14. printf (#X ","); \
  15. } \
  16. while (0)
  17. printf ("RequestedEvents: ");
  18. DO (VMInit);
  19. DO (VMDeath);
  20. DO (ThreadStart);
  21. DO (ThreadEnd);
  22. DO (ClassFileLoadHook);
  23. DO (ClassLoad);
  24. DO (ClassPrepare);
  25. DO (VMStart);
  26. DO (Exception);
  27. DO (ExceptionCatch);
  28. DO (SingleStep);
  29. DO (FramePop);
  30. DO (Breakpoint);
  31. DO (FieldAccess);
  32. DO (FieldModification);
  33. DO (MethodEntry);
  34. DO (MethodExit);
  35. DO (NativeMethodBind);
  36. DO (CompiledMethodLoad);
  37. DO (CompiledMethodUnload);
  38. DO (DynamicCodeGenerated);
  39. DO (DataDumpRequest);
  40. DO (MonitorWait);
  41. DO (MonitorWaited);
  42. DO (MonitorContendedEnter);
  43. DO (MonitorContendedEntered);
  44. DO (GarbageCollectionStart);
  45. DO (GarbageCollectionFinish);
  46. DO (ObjectFree);
  47. DO (VMObjectAlloc);
  48. printf ("\n");
  49. #undef DO
  50. }
  51. static void
  52. VMInitCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread)
  53. {
  54. printf ("VMInitCB jni_env=%#llx thread=%#llx\n",
  55. (unsigned long long) jni_env, (unsigned long long) thread);
  56. }
  57. static void
  58. VMDeathCB (jvmtiEnv *env, JNIEnv *jni_env)
  59. {
  60. printf ("VMDeathCB jni_env=%#llx\n", (unsigned long long) jni_env);
  61. }
  62. static void
  63. ThreadStartCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread)
  64. {
  65. printf ("ThreadStartCB jni_env=%#llx thread=%#llx\n",
  66. (unsigned long long) jni_env, (unsigned long long) thread);
  67. }
  68. static void
  69. ThreadEndCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread)
  70. {
  71. printf ("ThreadEndCB jni_env=%#llx thread=%#llx\n",
  72. (unsigned long long) jni_env, (unsigned long long) thread);
  73. }
  74. static void
  75. ClassFileLoadHookCB (jvmtiEnv *env, JNIEnv *jni_env,
  76. jclass class_being_redefined, jobject loader,
  77. const char *name, jobject protection_domain,
  78. jint class_data_len, const unsigned char *class_data,
  79. jint *new_class_data_len, unsigned char **new_class_data)
  80. {
  81. printf ("ClassFileLoadHookCB jni_env=%#llx class_being_redefined=%#llx"
  82. " loader=%#llx", (unsigned long long) jni_env, (unsigned long long)
  83. class_being_redefined, (unsigned long long) loader);
  84. printf (" name=%s protection_domain=%#llx class_data_len=%d class_data=%#llx",
  85. name, (unsigned long long) protection_domain, (int) class_data_len,
  86. (unsigned long long) class_data);
  87. printf (" new_class_data_len=%#llx new_class_data=%#llx\n",
  88. (unsigned long long) new_class_data_len, (unsigned long long)
  89. new_class_data);
  90. }
  91. static void
  92. ClassLoadCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jclass klass)
  93. {
  94. printf ("ClassLoadCB jni_env=%#llx thread=%#llx klass=%#llx\n",
  95. (unsigned long long) jni_env, (unsigned long long) thread,
  96. (unsigned long long) klass);
  97. }
  98. static void
  99. ClassPrepareCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jclass klass)
  100. {
  101. printf ("ClassPrepareCB jni_env=%#llx thread=%#llx klass=%#llx\n",
  102. (unsigned long long)jni_env, (unsigned long long) thread,
  103. (unsigned long long) klass);
  104. }
  105. static void
  106. VMStartCB (jvmtiEnv *env, JNIEnv *jni_env)
  107. {
  108. printf ("VMStartCB jni_env=%#llx\n", (unsigned long long) jni_env);
  109. }
  110. static void
  111. ExceptionCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jmethodID method,
  112. jlocation location, jobject exception, jmethodID catch_method,
  113. jlocation catch_location)
  114. {
  115. printf ("ExceptionCB jni_env=%#llx thread=%#llx method=%#llx location=%#llx",
  116. (unsigned long long) jni_env, (unsigned long long) thread,
  117. (unsigned long long) method, (unsigned long long) location);
  118. printf (" exception=%#llx catch_method=%#llx catch_location=%#llx\n",
  119. (unsigned long long) exception, (unsigned long long) catch_method,
  120. (unsigned long long) catch_location);
  121. }
  122. static void
  123. ExceptionCatchCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  124. jmethodID method, jlocation location, jobject exception)
  125. {
  126. printf ("ExceptionCatchCB jni_env=%#llx thread=%#llx method=%#llx"
  127. " location=%#llx",
  128. (unsigned long long) jni_env, (unsigned long long) thread,
  129. (unsigned long long) method, (unsigned long long) location);
  130. printf (" exception=%#llx\n", (unsigned long long) exception);
  131. }
  132. static void
  133. SingleStepCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jmethodID method,
  134. jlocation location)
  135. {
  136. printf ("SingleStepCB jni_env=%#llx thread=%#llx method=%#llx"
  137. " location=%#llx\n",
  138. (unsigned long long) jni_env, (unsigned long long) thread,
  139. (unsigned long long) method, (unsigned long long) location);
  140. }
  141. static void
  142. FramePopCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jmethodID method,
  143. jboolean was_popped_by_exception)
  144. {
  145. printf ("FramePopCB jni_env=%#llx thread=%#llx method=%#llx",
  146. (unsigned long long) jni_env, (unsigned long long) thread,
  147. (unsigned long long) method);
  148. printf (" was_pooped_by_exception=%d\n", (was_popped_by_exception ?
  149. 1 : 0));
  150. }
  151. static void
  152. BreakpointCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jmethodID method,
  153. jlocation location)
  154. {
  155. printf ("BreakpointCB jni_env=%#llx thread=%#llx method=%#llx"
  156. " location=%#llx\n", (unsigned long long) jni_env,
  157. (unsigned long long) thread, (unsigned long long) method,
  158. (unsigned long long) location);
  159. }
  160. static void
  161. FieldAccessCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  162. jmethodID method, jlocation location, jclass field_klass,
  163. jobject object, jfieldID field)
  164. {
  165. printf ("FieldAccessCB jni_env=%#llx thread=%#llx method=%#llx"
  166. " location=%#llx", (unsigned long long) jni_env, (unsigned long long)
  167. thread, (unsigned long long) method, (unsigned long long) location);
  168. printf (" field_klass=%#llx object=%#llx field=%#llx\n", (unsigned long long)
  169. field_klass, (unsigned long long) object, (unsigned long long) field);
  170. }
  171. static void
  172. FieldModificationCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  173. jmethodID method, jlocation location, jclass field_klass,
  174. jobject object, jfieldID field, char signature_type,
  175. jvalue new_value)
  176. {
  177. printf ("FieldModificationCB jni_env=%#llx thread=%#llx method=%#llx"
  178. " location=%#llx", (unsigned long long) jni_env, (unsigned long long)
  179. thread, (unsigned long long) method, (unsigned long long) location);
  180. printf (" field_klass=%#llx object=%#llx field=%#llx signature_type=%c",
  181. (unsigned long long) field_klass, (unsigned long long) object,
  182. (unsigned long long) field, signature_type);
  183. printf (" new_value=%#llx\n", (unsigned long long) new_value.l);
  184. }
  185. static void
  186. MethodEntryCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  187. jmethodID method)
  188. {
  189. printf ("MethodEntryCB jni_env=%#llx thread=%#llx method=%#llx\n",
  190. (unsigned long long) jni_env, (unsigned long long) thread,
  191. (unsigned long long) method);
  192. }
  193. static void
  194. MethodExitCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  195. jmethodID method, jboolean was_popped_by_exception,
  196. jvalue return_value)
  197. {
  198. printf ("MethodExitCB jni_env=%#llx thread=%#llx method=%#llx",
  199. (unsigned long long) jni_env, (unsigned long long) thread,
  200. (unsigned long long) method);
  201. printf (" was_popped_by_exception=%d return_value=%d\n",
  202. (was_popped_by_exception) ? 1 : 0, (int) return_value.i);
  203. }
  204. static void
  205. NativeMethodBindCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  206. jmethodID method, void *address, void **new_address_ptr)
  207. {
  208. printf ("NativeMethodBindCB jni_env=%#llx thread=%#llx method=%#llx",
  209. (unsigned long long) jni_env, (unsigned long long) thread,
  210. (unsigned long long) method);
  211. printf (" address=%#llx new_address_ptr=%#llx\n", (unsigned long long)
  212. address, (unsigned long long) new_address_ptr);
  213. }
  214. static void
  215. CompiledMethodLoadCB (jvmtiEnv *env, jmethodID method, jint code_size,
  216. const void *code_addr, jint map_length,
  217. const jvmtiAddrLocationMap *map,
  218. const void *compile_info)
  219. {
  220. printf ("CompiledMethodLoadCB method=%#llx code_size=%#llx code_addr=%#llx",
  221. (unsigned long long) method, (unsigned long long) code_size,
  222. (unsigned long long) code_addr);
  223. printf (" map_length=%d map=%#llx compile_info=%#llx\n", (int) map_length,
  224. (unsigned long long) map, (unsigned long long) compile_info);
  225. }
  226. static void
  227. CompiledMethodUnloadCB (jvmtiEnv *env, jmethodID method, const void *code_addr)
  228. {
  229. printf ("CompiledMethodUnloadCB method=%#llx code_addr=%#llx\n",
  230. (unsigned long long) method, (unsigned long long) code_addr);
  231. }
  232. static void
  233. DynamicCodeGeneratedCB (jvmtiEnv *env, const char *name, const void *address,
  234. jint length)
  235. {
  236. printf ("DynamicCodeGeneratedCB name=%s address=%#llx length=%d\n", name,
  237. (unsigned long long) address, (int) length);
  238. }
  239. static void
  240. DataDumpRequestCB (jvmtiEnv *env)
  241. {
  242. printf ("DataDumpRequestCB\n");
  243. }
  244. static void
  245. MonitorWaitCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread, jobject object,
  246. jlong timeout)
  247. {
  248. printf ("MonitorWaitCB jni_env=%#llx thread=%#llx object=%#llx timeout=%ld\n",
  249. (unsigned long long) jni_env, (unsigned long long) thread,
  250. (unsigned long long) object, (long) timeout);
  251. }
  252. static void
  253. MonitorWaitedCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  254. jobject object, jboolean timed_out)
  255. {
  256. printf ("MonitorWaitedCB jni_env=%#llx thread=%#llx object=%#llx"
  257. " timed_out=%d\n", (unsigned long long) jni_env, (unsigned long long)
  258. thread, (unsigned long long) object, (timed_out) ? 1 : 0);
  259. }
  260. static void
  261. MonitorContendedEnterCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  262. jobject object)
  263. {
  264. printf ("MonitorContendedEnterCB jni_env=%#llx thread=%#llx object=%#llx\n",
  265. (unsigned long long) jni_env, (unsigned long long) thread,
  266. (unsigned long long) object);
  267. }
  268. static void
  269. MonitorContendedEnteredCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  270. jobject object)
  271. {
  272. printf ("MonitorContendedEnteredCB jni_env=%#llx thread=%#llx object=%#llx\n",
  273. (unsigned long long) jni_env, (unsigned long long) thread,
  274. (unsigned long long) object);
  275. }
  276. static void
  277. GarbageCollectionStartCB (jvmtiEnv *env)
  278. {
  279. printf ("GarbageCollectionStartCB\n");
  280. }
  281. static void
  282. GarbageCollectionFinishCB (jvmtiEnv *env)
  283. {
  284. printf ("GarbageCollectionFinishCB\n");
  285. }
  286. static void
  287. ObjectFreeCB (jvmtiEnv *env, jlong tag)
  288. {
  289. printf ("ObjectFreeCB tag=%ld\n", (long) tag);
  290. }
  291. static void
  292. VMObjectAllocCB (jvmtiEnv *env, JNIEnv *jni_env, jthread thread,
  293. jobject object, jclass object_klass, jlong size)
  294. {
  295. printf ("VMObjectAllocCB jni_env=%#llx thread=%#llx object=%#llx",
  296. (unsigned long long) jni_env, (unsigned long long) thread,
  297. (unsigned long long) object);
  298. printf (" object_klass=%#llx size=%ld\n", (unsigned long long) object_klass,
  299. (long) size);
  300. }
  301. static void
  302. do_enable_tests ()
  303. {
  304. printf ("- enable tests -\n");
  305. JavaVM *vm = _Jv_GetJavaVM ();
  306. jvmtiEnv *env[3];
  307. int i;
  308. for (i = 0; i < 3; ++i)
  309. {
  310. vm->GetEnv (reinterpret_cast<void **> (&env[i]), JVMTI_VERSION_1_0);
  311. printf ("created JVMTI environment #%d\n", i);
  312. }
  313. jvmtiEventCallbacks callbacks;
  314. memset (&callbacks, 0, sizeof (jvmtiEventCallbacks));
  315. printf ("setting callbacks for envs\n");
  316. callbacks.VMInit = VMInitCB;
  317. env[0]->SetEventCallbacks (&callbacks, sizeof (callbacks));
  318. callbacks.VMDeath = VMDeathCB;
  319. env[1]->SetEventCallbacks (&callbacks, sizeof (callbacks));
  320. callbacks.ThreadEnd = ThreadEndCB;
  321. env[2]->SetEventCallbacks (&callbacks, sizeof (callbacks));
  322. print_events ();
  323. printf ("enable VM_INIT for env0, env1, env2\n");
  324. env[0]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
  325. env[1]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
  326. env[2]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
  327. print_events ();
  328. printf ("enable VM_DEATH for env1,env2\n");
  329. env[1]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
  330. env[2]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
  331. print_events ();
  332. /* Used to use a non-NULL event thread, but that causes problems
  333. when SetEventNotificationMode tries to validate the thread. */
  334. printf ("enable THREAD_END for env2\n");
  335. env[2]->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_THREAD_END,
  336. NULL);
  337. print_events ();
  338. printf ("disposing of env1\n");
  339. env[1]->DisposeEnvironment ();
  340. print_events ();
  341. printf ("disposing of env0\n");
  342. env[0]->DisposeEnvironment ();
  343. print_events ();
  344. printf ("disable VMInit in env2\n");
  345. env[2]->SetEventNotificationMode (JVMTI_DISABLE, JVMTI_EVENT_VM_INIT, NULL);
  346. print_events ();
  347. printf ("clear VMDeath callback in env2\n");
  348. callbacks.VMDeath = NULL;
  349. env[2]->SetEventCallbacks (&callbacks, sizeof (callbacks));
  350. print_events ();
  351. printf ("sending VMInit\n");
  352. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_INIT, (jthread) 0x1234,
  353. (JNIEnv *) 0x5678);
  354. printf ("sending ThreadEnd\n");
  355. _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_END, (jthread) 0x1234,
  356. (JNIEnv *) 0x5678);
  357. /* See comment above re: SetEventNotificationMode and validity
  358. checking
  359. printf ("sending ThreadEnd (no match)\n");
  360. _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_END, (jthread) 0x4321,
  361. (JNIEnv *) 0x5678);
  362. */
  363. printf ("sending VMDeath\n");
  364. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_DEATH, (jthread) NULL,
  365. (JNIEnv *) 0x5678);
  366. printf ("disposing of env2\n");
  367. env[2]->DisposeEnvironment ();
  368. print_events ();
  369. }
  370. static void
  371. do_callback_arg_tests ()
  372. {
  373. printf ("- callback arg tests -\n");
  374. JavaVM *vm = _Jv_GetJavaVM ();
  375. jvmtiEnv *env;
  376. vm->GetEnv (reinterpret_cast<void **> (&env), JVMTI_VERSION_1_0);
  377. // Define all the callbacks
  378. #define DEFINE(Event) callbacks.Event = Event ## CB;
  379. jvmtiEventCallbacks callbacks;
  380. DEFINE(VMInit);
  381. DEFINE(VMDeath);
  382. DEFINE(ThreadStart);
  383. DEFINE(ThreadEnd);
  384. DEFINE(ClassFileLoadHook);
  385. DEFINE(ClassLoad);
  386. DEFINE(ClassPrepare);
  387. DEFINE(VMStart);
  388. DEFINE(Exception);
  389. DEFINE(ExceptionCatch);
  390. DEFINE(SingleStep);
  391. DEFINE(FramePop);
  392. DEFINE(Breakpoint);
  393. DEFINE(FieldAccess);
  394. DEFINE(FieldModification);
  395. DEFINE(MethodEntry);
  396. DEFINE(MethodExit);
  397. DEFINE(NativeMethodBind);
  398. DEFINE(CompiledMethodLoad);
  399. DEFINE(CompiledMethodUnload);
  400. DEFINE(DynamicCodeGenerated);
  401. DEFINE(DataDumpRequest);
  402. DEFINE(MonitorWait);
  403. DEFINE(MonitorWaited);
  404. DEFINE(MonitorContendedEnter);
  405. DEFINE(MonitorContendedEntered);
  406. DEFINE(GarbageCollectionStart);
  407. DEFINE(GarbageCollectionFinish);
  408. DEFINE(ObjectFree);
  409. DEFINE(VMObjectAlloc);
  410. #undef DEFINE
  411. env->SetEventCallbacks (&callbacks, sizeof (callbacks));
  412. // Enable all the callbacks
  413. #define ENABLE(Event) \
  414. env->SetEventNotificationMode (JVMTI_ENABLE, JVMTI_EVENT_ ## Event, NULL)
  415. ENABLE (VM_INIT);
  416. ENABLE (VM_DEATH);
  417. ENABLE (THREAD_START);
  418. ENABLE (THREAD_END);
  419. ENABLE (CLASS_FILE_LOAD_HOOK);
  420. ENABLE (CLASS_LOAD);
  421. ENABLE (CLASS_PREPARE);
  422. ENABLE (VM_START);
  423. ENABLE (EXCEPTION);
  424. ENABLE (EXCEPTION_CATCH);
  425. ENABLE (SINGLE_STEP);
  426. ENABLE (FRAME_POP);
  427. ENABLE (BREAKPOINT);
  428. ENABLE (FIELD_ACCESS);
  429. ENABLE (FIELD_MODIFICATION);
  430. ENABLE (METHOD_ENTRY);
  431. ENABLE (METHOD_EXIT);
  432. ENABLE (NATIVE_METHOD_BIND);
  433. ENABLE (COMPILED_METHOD_LOAD);
  434. ENABLE (COMPILED_METHOD_UNLOAD);
  435. ENABLE (DYNAMIC_CODE_GENERATED);
  436. ENABLE (DATA_DUMP_REQUEST);
  437. ENABLE (MONITOR_WAIT);
  438. ENABLE (MONITOR_WAITED);
  439. ENABLE (MONITOR_CONTENDED_ENTER);
  440. ENABLE (MONITOR_CONTENDED_ENTERED);
  441. ENABLE (GARBAGE_COLLECTION_START);
  442. ENABLE (GARBAGE_COLLECTION_FINISH);
  443. ENABLE (OBJECT_FREE);
  444. ENABLE (VM_OBJECT_ALLOC);
  445. // All events should now be enabled.
  446. print_events ();
  447. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_INIT, (jthread) 0x2, (JNIEnv *) 0x1);
  448. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_DEATH, (jthread) 0x2, (JNIEnv *) 0x1);
  449. _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_START, (jthread) 0x2,
  450. (JNIEnv *) 0x1);
  451. _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_END, (jthread) 0x2,
  452. (JNIEnv *) 0x1);
  453. _Jv_JVMTI_PostEvent (JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, (jthread) 0xb00,
  454. (JNIEnv *) 0x1, (jclass) 0x2, (jobject) 0x3,
  455. "4", (jobject) 0x5, (jint) 6,
  456. (const unsigned char *) 0x7, (jint *) 0x8,
  457. (unsigned char **) 0x9);
  458. _Jv_JVMTI_PostEvent (JVMTI_EVENT_CLASS_LOAD, (jthread) 0x2, (JNIEnv *) 0x1,
  459. (jclass) 0x3);
  460. _Jv_JVMTI_PostEvent (JVMTI_EVENT_CLASS_PREPARE, (jthread) 0x2,
  461. (JNIEnv *) 0x1, (jclass) 0x3);
  462. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_START, (jthread) 0xb00, (JNIEnv *) 0x1);
  463. _Jv_JVMTI_PostEvent (JVMTI_EVENT_EXCEPTION, (jthread) 0x2, (JNIEnv *) 0x1,
  464. (jmethodID) 0x3, (jlocation) 0x4, (jobject) 0x5,
  465. (jmethodID) 0x6, (jlocation) 0x7);
  466. _Jv_JVMTI_PostEvent (JVMTI_EVENT_EXCEPTION_CATCH, (jthread) 0x2,
  467. (JNIEnv *) 0x1, (jmethodID) 0x3, (jlocation) 0x4,
  468. (jobject) 0x5);
  469. _Jv_JVMTI_PostEvent (JVMTI_EVENT_SINGLE_STEP, (jthread) 0x2, (JNIEnv *) 0x1,
  470. (jmethodID) 0x3, (jlocation) 0x4);
  471. _Jv_JVMTI_PostEvent (JVMTI_EVENT_FRAME_POP, (jthread) 0x2, (JNIEnv *) 0x1,
  472. (jmethodID) 0x3, 4);
  473. _Jv_JVMTI_PostEvent (JVMTI_EVENT_BREAKPOINT, (jthread) 0x2, (JNIEnv *) 0x1,
  474. (jmethodID) 0x3, (jlocation) 0x4);
  475. _Jv_JVMTI_PostEvent (JVMTI_EVENT_FIELD_ACCESS, (jthread) 0x2,
  476. (JNIEnv *) 0x1, (jmethodID) 0x3, (jlocation) 0x4,
  477. (jclass) 0x5, (jobject) 0x6, (jfieldID) 0x7);
  478. jvalue value;
  479. value.l = (jobject) 0x9;
  480. _Jv_JVMTI_PostEvent (JVMTI_EVENT_FIELD_MODIFICATION, (jthread) 0x2,
  481. (JNIEnv *) 0x1, (jmethodID) 0x3, (jlocation) 0x4,
  482. (jclass) 0x5, (jobject) 0x6, (jfieldID) 0x7,
  483. (int) '8', value);
  484. _Jv_JVMTI_PostEvent (JVMTI_EVENT_METHOD_ENTRY, (jthread) 0x2,
  485. (JNIEnv *) 0x1, (jmethodID) 0x3);
  486. jvalue value2;
  487. value2.i = 5;
  488. _Jv_JVMTI_PostEvent (JVMTI_EVENT_METHOD_EXIT, (jthread) 0x2,
  489. (JNIEnv *) 0x1, (jmethodID) 0x3, 4, value2);
  490. _Jv_JVMTI_PostEvent (JVMTI_EVENT_NATIVE_METHOD_BIND, (jthread) 0x2,
  491. (JNIEnv *) 0x1, (jmethodID) 0x3, (void *) 0x4,
  492. (void **) 0x5);
  493. _Jv_JVMTI_PostEvent (JVMTI_EVENT_COMPILED_METHOD_LOAD, (jthread) 0xb00,
  494. (jmethodID) 0x1, (jint) 2, (const void *) 0x3,
  495. (jint) 4, (const jvmtiAddrLocationMap *) 0x5,
  496. (const void *) 0x6);
  497. _Jv_JVMTI_PostEvent (JVMTI_EVENT_COMPILED_METHOD_UNLOAD, (jthread) 0xb00,
  498. (jmethodID) 0x1, (const void *) 0x2);
  499. _Jv_JVMTI_PostEvent (JVMTI_EVENT_DYNAMIC_CODE_GENERATED, (jthread) 0xb00,
  500. "1", (const void *) 0x2, (jint) 3);
  501. _Jv_JVMTI_PostEvent (JVMTI_EVENT_DATA_DUMP_REQUEST, (jthread) 0xb00);
  502. _Jv_JVMTI_PostEvent (JVMTI_EVENT_MONITOR_WAIT, (jthread) 0x2,
  503. (JNIEnv *) 0x1, (jobject) 0x3, (jlong) 4);
  504. _Jv_JVMTI_PostEvent (JVMTI_EVENT_MONITOR_WAITED, (jthread) 0x2,
  505. (JNIEnv *) 0x1, (jobject) 0x3, (int) 4);
  506. _Jv_JVMTI_PostEvent (JVMTI_EVENT_MONITOR_CONTENDED_ENTER, (jthread) 0x2,
  507. (JNIEnv *) 0x1, (jobject) 0x3);
  508. _Jv_JVMTI_PostEvent (JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, (jthread) 0x2,
  509. (JNIEnv *) 0x1, (jobject) 0x3);
  510. _Jv_JVMTI_PostEvent (JVMTI_EVENT_GARBAGE_COLLECTION_START, (jthread) 0xb00);
  511. _Jv_JVMTI_PostEvent (JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, (jthread) 0xb00);
  512. _Jv_JVMTI_PostEvent (JVMTI_EVENT_OBJECT_FREE, (jthread) 0xb00, (jlong) 1);
  513. _Jv_JVMTI_PostEvent (JVMTI_EVENT_VM_OBJECT_ALLOC, (jthread) 0x2,
  514. (JNIEnv *) 0x1, (jobject) 0x3, (jclass) 0x4,
  515. (jlong) 5);
  516. }
  517. void
  518. events::do_events_tests ()
  519. {
  520. do_enable_tests ();
  521. do_callback_arg_tests ();
  522. }