Ejemplo n.º 1
0
  @Override
  public void choiceGeneratorSet(VM vm, ChoiceGenerator<?> newCG) {
    ChoiceGenerator<?> cg = VM.getVM().getChoiceGenerator();
    if (cg instanceof ThreadChoiceGenerator) {
      threadCGs++;

      Instruction insn = cg.getInsn();
      if (insn instanceof JVMFieldInstruction) {
        sharedAccessCGs++;
      } else if (insn instanceof LockInstruction || insn instanceof JVMInvokeInstruction) {
        monitorCGs++;
      } else if (insn instanceof EXECUTENATIVE) {
        MethodInfo mi = insn.getMethodInfo();
        if (mi != null) {
          ClassInfo ci = mi.getClassInfo();
          if (ci != null) {
            if (ci.isObjectClassInfo()) {
              // its got to be either a wait or a notify since we know the java.lang.Object methods
              signalCGs++;
            } else if (ci.isThreadClassInfo()) {
              threadApiCGs++;
            }
          } else {
            // Hmm - a CG from a synthetic method?
          }
        } else {
          // even more Hmmm - a GC from a synthesized instruction
        }
      } else {
        breakTransitionCGs++; // e.g. max_transition_length or idleLoop breakers
      }
    } else {
      dataCGs++;
    }
  }
Ejemplo n.º 2
0
  @Override
  public void gcBegin(VM vm) {
    int heapSize = vm.getHeap().size();
    if (heapSize > maxLiveObjects) {
      maxLiveObjects = heapSize;
    }

    gcCycles++;
  }
Ejemplo n.º 3
0
 private void exec(String name, Search search) {
   VM vm = search.getVM();
   PCChoiceGenerator choiceGenerator = vm.getLastChoiceGeneratorOfType(PCChoiceGenerator.class);
   if (choiceGenerator != null) {
     PathCondition pc = choiceGenerator.getCurrentPC();
     if (search.getErrors().size() < 0) {
       return;
     }
     Property property = search.getLastError().getProperty();
     if (!property.getErrorMessage().contains(AssertionError.class.getCanonicalName())) {
       pc.header = pc.header.not();
     }
     /*
      * if (property instanceof NoUncaughtExceptionsProperty) {
      * NoUncaughtExceptionsProperty noUncaughtExceptionsProperty =
      * (NoUncaughtExceptionsProperty) property; String clName =
      * noUncaughtExceptionsProperty
      * .getUncaughtExceptionInfo().getCauseClassname();
      * if(!clName.equals(AssertionError.class.getCanonicalName())) {
      *
      * } System.out.println(clName); }
      */
     //
     /*
      * if (instruction instanceof IfInstruction) { if
      * (((IfInstruction) instruction).getConditionValue()) {
      * pc.solve();
      *
      * } }
      */
     pc.solve();
     Map<String, Object> varsVals = new HashMap<String, Object>();
     pc.header.getVarVals(varsVals);
     if (varsVals.containsKey("guess_fix")) {
       this.result = varsVals.get("guess_fix");
       if (processor.getType().equals(Boolean.class)) {
         this.result = this.result.equals(1);
       }
     }
     logger.debug("JPF Result " + this.result);
   }
 }