Example #1
0
void VMEvent::clear_event_request(VMEvent *ep)
{
  LocationModifier::Raw mod;
  Thread::Raw thread;

  VMEvent::remove_event_request(ep);
#ifdef AZZERT
  if (TraceDebugger) {
    tty->print_cr("VMEvent: clear 0x%x, id 0x%x", (int)ep->obj(), ep->event_id());
  }
#endif
  switch (ep->event_kind()) {
  case JDWP_EventKind_BREAKPOINT:
    mod = get_modifier(ep,
        JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly);
    GUARANTEE(!mod.is_null(), "No location modifier for breakpoint event");
    if (!mod.is_null()) {
#if ENABLE_ISOLATES
      // See if any other task already has a breakpoint here.
      VMEvent::Raw epb = find_breakpoint_event(&mod);
      if (!epb.is_null()) {
        // Has to be some other task since we have unlinked this event
        GUARANTEE(epb().task_id() != ep->task_id(),
                  "Duplicate breakpoint event for this task");
      } else {
#endif
        mod().set_method_opcode(mod().save_opcode(), false);
#if ENABLE_ISOLATES
      }
#endif
    }
    break;
  case JDWP_EventKind_SINGLE_STEP:
    mod = get_modifier(ep,
        JDWP_EventRequest_Set_Out_modifiers_Modifier_Step);
    if (mod.not_null()) {
      thread = JavaDebugger::get_thread_by_id(mod().thread_id());
      if (thread.not_null())
        thread().set_is_stepping(false);
      JavaDebugger::set_stepping(false);
    }
    break;
  }
  // see if there are any other breakpoints in this method.  If no other 
  // breakpoints and the compiler is active then clear the
  // impossible_to_compile flag.
  if (mod.not_null() && (ep->event_kind() == JDWP_EventKind_BREAKPOINT ||
         ep->event_kind() == JDWP_EventKind_SINGLE_STEP)) {
    clear_impossible_to_compile(&mod, ep);
  }
}
Example #2
0
ReturnOop VMEvent::find_breakpoint_event(int class_id, jlong method_id,
                                         jlong offset, int task_id)
{
  // May be called during GC via GenerateStackMap::run().

  VMEventStream es;
  VMEvent::Raw ep;
  LocationModifier::Raw  loc;

  while (!es.at_end()) {
    ep = es.next_by_kind(JDWP_EventKind_BREAKPOINT);
    if (ep.is_null()) {
      return NULL;
    }
#if ENABLE_ISOLATES
    // If task_id == -1 && ep.task_id == -1 then we don't care
    // which task this is we check the event otherwise we skip it
    if (task_id != -1 && ep().task_id() != -1 &&
        (ep().task_id() != task_id)) {
      continue;
    }
#else
    (void)task_id;
#endif
    loc = get_modifier(&ep,
        JDWP_EventRequest_Set_Out_modifiers_Modifier_LocationOnly);
    if (loc.not_null()) {
      if (loc().clazz_id() == class_id &&
          loc().method_id() == method_id && 
          loc().offset() == offset) {
        return ep;
      }
    }
  }
  return (ReturnOop)NULL;
}