public static int getSolvedPC(MJIEnv env, int objRef) {
   PathCondition pc = getPC(env);
   if (pc != null) {
     pc.solve();
     return env.newString(pc.toString());
   }
   return env.newString("");
 }
Esempio n. 2
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);
   }
 }