void VMEvent::create_event_request(PacketInputStream *in, PacketOutputStream *out, jbyte event_kind) { UsingFastOops fast_oops; VMEvent::Fast ep; int i; bool error = false; VMEventModifier::Fast current_modifier_slot, new_modifier, event_modifier; ep = create_vm_event_request(); ep().set_event_kind(event_kind); ep().set_suspend_policy(in->read_byte()); ep().set_num_modifiers(in->read_int()); Transport *transport = in->transport(); ep().set_transport(transport); #if ENABLE_ISOLATES ep().set_task_id(transport->task_id()); TaskGCContext tmp(transport->task_id()); #endif for (i=0; i < ep().num_modifiers(); i++) { new_modifier = VMEventModifier::new_modifier(in, out, error); if (error) { // some sort of error happened if (out->error() != 0) { out->send_packet(); } return; } if (new_modifier.is_null()) { // Most likely we don't support this modifier continue; } if (event_kind == JDWP_EventKind_BREAKPOINT && new_modifier().mod_kind() == JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly) { UsingFastOops fastoops2; LocationModifier *lmp = (LocationModifier *)&new_modifier; VMEvent::Fast epb = VMEvent::find_breakpoint_event(lmp, transport->task_id()); if (epb.not_null()) { out->write_int(epb().event_id()); out->send_packet(); // out->send_error(JDWP_Error_NOT_IMPLEMENTED); // there's a breakpoint here already, don't bother installing another return; } #if ENABLE_ISOLATES InstanceClass::Raw ic = JavaDebugger::get_object_by_id(new_modifier().clazz_id()); if (ic().class_id() < ROM::number_of_system_classes()) { // breakpoint in system class, allow in any task ep().set_task_id(-1); } // See if any other task already has a breakpoint here. epb = find_breakpoint_event(lmp); if (!epb.is_null()) { // Has to be some other task since we haven't linked in this event GUARANTEE(epb().task_id() != transport->task_id(), "Breakpoint already inserted"); LocationModifier::Raw lmod = get_modifier(&epb, JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly); GUARANTEE(!lmod.is_null(),"Breakpoint event has no location modifier"); lmp->set_save_opcode(lmod().save_opcode()); } else { #endif /* Return an error back to the debugger if * the breakpoint could not be installed. */ lmp->unlink_method(); lmp->save_method_entry(); if (lmp->set_method_opcode(Bytecodes::_breakpoint, true) == false){ out->send_error(JDWP_Error_INVALID_LOCATION); return; } #if ENABLE_ISOLATES } #endif } // insert the mod at the end of the list of modifiers event_modifier = ep().mods(); if (event_modifier.is_null()) { ep().set_mods(&new_modifier); current_modifier_slot = ep().mods(); } else { current_modifier_slot().set_next(&new_modifier); current_modifier_slot = new_modifier; } } #ifdef AZZERT if (TraceDebugger) { tty->print_cr("Create Event: xprt = 0x%x, ep = 0x%lx, id = 0x%x, kind = 0x%lx, suspend = 0x%lx, num mods = 0x%lx", transport->obj(), ep.obj(), ep().event_id(), ep().event_kind(), ep().suspend_policy(), ep().num_modifiers()); } #endif ep().set_next((VMEvent *)Universe::vmevent_request_head()); *Universe::vmevent_request_head() = ep; out->write_int(ep().event_id()); out->send_packet(); VMEvent::add_notification(JDWP_eventkind_to_dbg_eventkind(event_kind)); }