Package org.jakstab.rtl

Examples of org.jakstab.rtl.Context


          continue;
       
        evaldStatement = new AssignmentTemplate(a.getBitWidth(), evaldLHS, evaldRHS);
       
      } else /* non AssignmentTemplate */ {
        evaldStatement = statement.evaluate(new Context());
      }

      addLast(evaldStatement);
    }
    if (sequence.size() < 1)
View Full Code Here


    RTLExpression addrExp = ExpressionFactory.createPlus(
        ExpressionFactory.createNumber(4),
        ExpressionFactory.createVariable("x", 32),
        ExpressionFactory.createNumber(8));
    RTLMemoryLocation memLoc32 = ExpressionFactory.createMemoryLocation(addrExp, 32);
    RTLMemoryLocation evaldMemLoc32 = (RTLMemoryLocation)memLoc32.evaluate(new Context());
    assertTrue(evaldMemLoc32.getAddress() instanceof RTLOperation);
    RTLOperation newAddrExp = (RTLOperation)evaldMemLoc32.getAddress();
    assertEquals(2, newAddrExp.getOperandCount());
  }
View Full Code Here

          );
          // set next label to jump target
          nextLabel = new Location(new AbsoluteAddress(targetValue));
        }
      }
      assumption = assumption.evaluate(new Context());
      RTLAssume assume = new RTLAssume(assumption, stmt);
      assume.setLabel(stmt.getLabel());
      assume.setNextLabel(nextLabel);
      results.add(new CFAEdge(stmt.getLabel(), nextLabel, assume));
    }
View Full Code Here

    // Just go through all patterns and check for a match
    for (int i=0; i<patterns.length; i++) {
      if (match(e, patterns[i], bindings)) {
        // Success
        Context context = new Context();
        for (Map.Entry<RTLVariable, RTLExpression> binding : bindings.entrySet())
          context.substitute(binding.getKey(), binding.getValue());
        RTLExpression result = results[i].evaluate(context);
        //logger.debug("Simplified " + e + " to " + result);
        e = result;
      }
      bindings.clear();
View Full Code Here

              );
          // set next label to jump target
          nextLabel = new Location(new AbsoluteAddress(targetValue));
        }
      }
      assumption = assumption.evaluate(new Context());
      RTLAssume assume = new RTLAssume(assumption, stmt);
      assume.setLabel(stmt.getLabel());
      assume.setNextLabel(nextLabel);
      results.add(new CFAEdge(assume.getLabel(), assume.getNextLabel(), assume));
    }
View Full Code Here

       
        // Negated variables can match constants
        if (subExpr instanceof RTLNumber && e.getOperator() == Operator.NEG) {
          // Negate the number
          subExpr = ExpressionFactory.createNeg(subExpr);
          subExpr = subExpr.evaluate(new Context());
          assert (subExpr instanceof RTLNumber);
          // Match the expression within the negation to the negated number
          return e.getOperands()[0].accept(this);
        }
       
View Full Code Here

    if (newStmt != stmt)
      edge.setTransformer(newStmt);
  }
 
  public static RTLStatement substituteStatement(RTLStatement stmt, SubstitutionState s) {
    Context substCtx = new Context();
    for (RTLVariable v : stmt.getUsedVariables()) {
      SubstitutionElement el = s.getValue(v);
      if (!el.isTop()) {
        substCtx.addAssignment(v, el.getExpression());
      }
    }
    if (!substCtx.getAssignments().isEmpty()) {
      //logger.info("Old stmt: " + stmt);
      RTLStatement newStmt = stmt.copy().evaluate(substCtx);
      //logger.info("New stmt: " + newStmt);
      if (newStmt != null) {
        return newStmt.evaluate(new Context());
      } else {
        RTLSkip skip = new RTLSkip();
        skip.setLabel(stmt.getLabel());
        skip.setNextLabel(stmt.getNextLabel());
        return skip;
View Full Code Here

              );
          // set next label to jump target
          nextLabel = new Location(new AbsoluteAddress(targetValue));
        }
      }
      assumption = assumption.evaluate(new Context());
      RTLAssume assume = new RTLAssume(assumption, stmt);
      assume.setLabel(stmt.getLabel());
      assume.setNextLabel(nextLabel);
      // Target address sanity check
      if (nextLabel.getAddress().getValue() < 10L) {
View Full Code Here

              );
          // set next label to jump target
          nextLabel = new Location(new AbsoluteAddress(targetValue));
        }
      }
      assumption = assumption.evaluate(new Context());
      RTLAssume assume = new RTLAssume(assumption, stmt);
      assume.setLabel(stmt.getLabel());
      assume.setNextLabel(nextLabel);
      // Target address sanity check
      if (nextLabel.getAddress().getValue() < 10L) {
View Full Code Here

        for (RTLNumber cVal : parentVal.concretize()) {
          if (cVal == null) {
            cValues = null;
            break;
          }
          Context ctx = new Context();
          ctx.addAssignment(parent, cVal);
          RTLExpression result = asParent.evaluate(ctx);
          cValues.add((RTLNumber)result);
        }
        if (cValues != null) {
          e = valueFactory.createAbstractValue(cValues);
View Full Code Here

TOP

Related Classes of org.jakstab.rtl.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.