Example #1
0
 /*
  * @see
  * org.jakstab.analysis.LatticeElement#lessOrEqual(org.jakstab.analysis.
  * LatticeElement)
  */
 @Override
 public boolean lessOrEqual(LatticeElement l) {
   if (l.isTop() || this.isBot()) return true;
   if (isTop() || l.isBot()) return false;
   SubstitutionElement other = (SubstitutionElement) l;
   if (expression.equals(other.getExpression())) return true;
   return false;
 }
Example #2
0
 /*
  * @see
  * org.jakstab.analysis.AbstractValue#join(org.jakstab.analysis.LatticeElement
  * )
  */
 @Override
 public SubstitutionElement join(LatticeElement l) {
   if (l.isBot()) return this;
   SubstitutionElement other = (SubstitutionElement) l;
   if (this.isBot()) return other;
   if (expression.equals(other.getExpression())) return this;
   return TOP;
 }
Example #3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   SubstitutionElement other = (SubstitutionElement) obj;
   if (expression == null) {
     if (other.expression != null) return false;
   } else if (!expression.equals(other.expression)) return false;
   return true;
 }
  @Override
  public Set<Tuple<RTLNumber>> projectionFromConcretization(RTLExpression... expressions) {

    // Only concretize expression requests from transformerFactory
    // Warning: If this method is invoked with 2 parameters for other reasons, it will
    //          likely fail!
    if (expressions.length != 2) return null;

    // If not on trace, don't concretize
    if (isBot()) return null;

    RTLExpression condition = expressions[0];
    RTLExpression target = expressions[1];
    RTLNumber cCondition;
    RTLNumber cTarget;

    Set<Tuple<RTLNumber>> res = new FastSet<Tuple<RTLNumber>>();

    for (AbsoluteAddress successor : getNextPC()) {
      RTLNumber nextPC = successor.toNumericConstant();

      if (target instanceof RTLNumber) {
        // If target is a number, this is a direct jump, and maybe conditional

        cTarget = (RTLNumber) target;

        if (condition instanceof RTLNumber) {
          // Direct, unconditional jump
          cCondition = (RTLNumber) condition;
        } else if (target.equals(nextPC)) {
          // Conditional jump that is taken according to the trace
          cCondition = ExpressionFactory.TRUE;
        } else {
          // Conditional jump that is not taken
          cCondition = ExpressionFactory.FALSE;
        }

      } else {
        // Target is not a number, so this is an indirect jump

        assert (condition instanceof RTLNumber)
            : "There should be no conditional indirect jumps in x86!";
        cCondition = (RTLNumber) condition;
        cTarget = nextPC;
      }
      res.add(Tuple.create(cCondition, cTarget));
    }

    return res;
  }