< prev index next >

src/share/vm/prims/jvmtiExport.cpp

Print this page




2390         extern struct JavaVM_ main_vm;
2391         JvmtiThreadEventMark jem(THREAD);
2392         JvmtiJavaThreadEventTransition jet(THREAD);
2393 
2394         result = (*on_attach_entry)(&main_vm, (char*)options, NULL);
2395       }
2396 
2397       // Agent_OnAttach may have used JNI
2398       if (HAS_PENDING_EXCEPTION) {
2399         CLEAR_PENDING_EXCEPTION;
2400       }
2401 
2402       // If OnAttach returns JNI_OK then we add it to the list of
2403       // agent libraries so that we can call Agent_OnUnload later.
2404       if (result == JNI_OK) {
2405         Arguments::add_loaded_agent(agent_lib);
2406       } else {
2407         delete agent_lib;
2408       }
2409 
2410       // Agent_OnAttach executed so completion status is JNI_OK
2411       st->print_cr("%d", result);
2412       result = JNI_OK;
2413     }
2414   }
2415   return result;
2416 }
2417 
2418 #endif // INCLUDE_SERVICES
2419 ////////////////////////////////////////////////////////////////////////////////////////////////
2420 
2421 // Setup current current thread for event collection.
2422 void JvmtiEventCollector::setup_jvmti_thread_state() {
2423   // set this event collector to be the current one.
2424   JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
2425   // state can only be NULL if the current thread is exiting which
2426   // should not happen since we're trying to configure for event collection
2427   guarantee(state != NULL, "exiting thread called setup_jvmti_thread_state");
2428   if (is_vm_object_alloc_event()) {
2429     _prev = state->get_vm_object_alloc_event_collector();
2430     state->set_vm_object_alloc_event_collector((JvmtiVMObjectAllocEventCollector *)this);
2431   } else if (is_dynamic_code_event()) {
2432     _prev = state->get_dynamic_code_event_collector();




2390         extern struct JavaVM_ main_vm;
2391         JvmtiThreadEventMark jem(THREAD);
2392         JvmtiJavaThreadEventTransition jet(THREAD);
2393 
2394         result = (*on_attach_entry)(&main_vm, (char*)options, NULL);
2395       }
2396 
2397       // Agent_OnAttach may have used JNI
2398       if (HAS_PENDING_EXCEPTION) {
2399         CLEAR_PENDING_EXCEPTION;
2400       }
2401 
2402       // If OnAttach returns JNI_OK then we add it to the list of
2403       // agent libraries so that we can call Agent_OnUnload later.
2404       if (result == JNI_OK) {
2405         Arguments::add_loaded_agent(agent_lib);
2406       } else {
2407         delete agent_lib;
2408       }
2409 

2410       st->print_cr("%d", result);

2411     }
2412   }
2413   return result;
2414 }
2415 
2416 #endif // INCLUDE_SERVICES
2417 ////////////////////////////////////////////////////////////////////////////////////////////////
2418 
2419 // Setup current current thread for event collection.
2420 void JvmtiEventCollector::setup_jvmti_thread_state() {
2421   // set this event collector to be the current one.
2422   JvmtiThreadState* state = JvmtiThreadState::state_for(JavaThread::current());
2423   // state can only be NULL if the current thread is exiting which
2424   // should not happen since we're trying to configure for event collection
2425   guarantee(state != NULL, "exiting thread called setup_jvmti_thread_state");
2426   if (is_vm_object_alloc_event()) {
2427     _prev = state->get_vm_object_alloc_event_collector();
2428     state->set_vm_object_alloc_event_collector((JvmtiVMObjectAllocEventCollector *)this);
2429   } else if (is_dynamic_code_event()) {
2430     _prev = state->get_dynamic_code_event_collector();


< prev index next >