コード例 #1
0
 protected ObjectReference getThisObject(SuspendContextImpl context, LocatableEvent event)
     throws EvaluateException {
   ThreadReferenceProxyImpl thread = context.getThread();
   if (thread != null) {
     StackFrameProxyImpl stackFrameProxy = thread.frame(0);
     if (stackFrameProxy != null) {
       return stackFrameProxy.thisObject();
     }
   }
   return null;
 }
コード例 #2
0
ファイル: DebuggerUtilsEx.java プロジェクト: jared2501/test
  @NotNull
  public static List<Pair<Breakpoint, Event>> getEventDescriptors(
      SuspendContextImpl suspendContext) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    if (suspendContext == null) {
      return Collections.emptyList();
    }
    final EventSet events = suspendContext.getEventSet();
    if (events == null) {
      return Collections.emptyList();
    }
    final List<Pair<Breakpoint, Event>> eventDescriptors = new SmartList<Pair<Breakpoint, Event>>();

    final RequestManagerImpl requestManager = suspendContext.getDebugProcess().getRequestsManager();
    for (final Event event : events) {
      final Requestor requestor = requestManager.findRequestor(event.request());
      if (requestor instanceof Breakpoint) {
        eventDescriptors.add(Pair.create((Breakpoint) requestor, event));
      }
    }
    return eventDescriptors;
  }
コード例 #3
0
  public boolean processLocatableEvent(
      final SuspendContextCommandImpl action, final LocatableEvent event)
      throws EventProcessingException {
    final SuspendContextImpl context = action.getSuspendContext();
    if (!isValid()) {
      context.getDebugProcess().getRequestsManager().deleteRequest(this);
      return false;
    }

    final String[] title = {DebuggerBundle.message("title.error.evaluating.breakpoint.condition")};

    try {
      final StackFrameProxyImpl frameProxy = context.getThread().frame(0);
      if (frameProxy == null) {
        // might be if the thread has been collected
        return false;
      }

      final EvaluationContextImpl evaluationContext =
          new EvaluationContextImpl(
              action.getSuspendContext(), frameProxy, getThisObject(context, event));

      if (!evaluateCondition(evaluationContext, event)) {
        return false;
      }

      title[0] = DebuggerBundle.message("title.error.evaluating.breakpoint.action");
      runAction(evaluationContext, event);
    } catch (final EvaluateException ex) {
      if (ApplicationManager.getApplication().isUnitTestMode()) {
        System.out.println(ex.getMessage());
        return false;
      }

      throw new EventProcessingException(title[0], ex.getMessage(), ex);
    }

    return true;
  }