Пример #1
0
 protected void evaluate(final AbstractEvaluationModel model) {
   if (!(myDebugSession.getEvaluationProvider().canEvaluate())) {
     setErrorText("Program should be paused on breakpoint to evaluate");
     return;
   }
   try {
     final Class clazz = model.generateAndLoadEvaluatorClass();
     setEvaluating(model);
     final DebugVMEventsProcessor eventsProcessor = myDebugSession.getEventsProcessor();
     eventsProcessor.invokeInManagerThreadAndFork(
         new _FunctionTypes._void_P0_E0() {
           public void invoke() {
             SuspendContext suspendContext =
                 eventsProcessor.getSuspendManager().getPausedContext();
             assert suspendContext != null;
             try {
               Evaluator evaluator = model.createEvaluatorInstance(clazz);
               suspendContext.setIsEvaluating(true);
               IValueProxy evaluatedValue = evaluator.evaluate();
               if (evaluatedValue != null) {
                 setSuccess(evaluatedValue, model);
               } else {
                 setFailure(null, "Evaluation returned null.", model);
               }
             } catch (EvaluationException e) {
               setFailure(e, null, model);
             } catch (Throwable t) {
               setFailure(t, null, model);
               LOG.error(t);
             } finally {
               suspendContext.setIsEvaluating(false);
             }
           }
         });
   } catch (InvalidEvaluatedExpressionException e) {
     setFailure(e.getCause(), null, model);
   } catch (InvocationTargetEvaluationException e) {
     setFailure(e.getCause(), null, model);
     LOG.error(e.getCause());
   } catch (EvaluationException e) {
     setFailure(e, null, model);
   } catch (Throwable t) {
     setFailure(t, null, model);
     LOG.error(t);
   }
 }
Пример #2
0
 @Override
 protected void createRequestForPreparedClass(
     DebugVMEventsProcessor debugProcess, final ReferenceType classType) {
   RequestManager requestManager = debugProcess.getRequestManager();
   try {
     int lineIndex = myLocation.getLineIndexInFile();
     List<Location> locs = classType.locationsOfLine(lineIndex);
     if (locs.size() > 0) {
       for (final Location location : locs) {
         BreakpointRequest request = requestManager.createBreakpointRequest(this, location);
         requestManager.enableRequest(request);
       }
     } else {
       //  there's no executable code in this class
       requestManager.setInvalid(this, "no executable code found");
       String message =
           "No locations of type "
               + classType.name()
               + " found at line "
               + myLocation.getLineIndexInFile();
       LOG.warning(message);
     }
   } catch (ClassNotPreparedException ex) {
     LOG.warning("ClassNotPreparedException: " + ex.getMessage());
     //  there's a chance to add a breakpoint when the class is prepared
   } catch (ObjectCollectedException ex) {
     LOG.warning("ObjectCollectedException: " + ex.getMessage());
     //  there's a chance to add a breakpoint when the class is prepared
   } catch (InvalidLineNumberException ex) {
     requestManager.setInvalid(this, "no executable code found");
     LOG.warning("InvalidLineNumberException: " + ex.getMessage());
   } catch (InternalException ex) {
     LOG.error(ex);
   } catch (Exception ex) {
     LOG.error(ex);
   }
 }