use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class SymbolicFunctionVM method CALL_RESULT.
@Override
public void CALL_RESULT(int conc_ret_val, String owner, String name, String desc) {
if (functionUnderExecution != null) {
if (!functionUnderExecution.getOwner().equals(owner) || !functionUnderExecution.getName().equals(name) || !functionUnderExecution.getDesc().equals(desc)) {
functionUnderExecution = null;
}
}
if (functionUnderExecution != null) {
IntegerValue symb_ret_val = this.env.topFrame().operandStack.peekBv32();
functionUnderExecution.setReturnValue(conc_ret_val, symb_ret_val);
IntegerValue new_symb_ret_val = (IntegerValue) functionUnderExecution.executeFunction();
this.replaceTopBv32(new_symb_ret_val);
}
functionUnderExecution = null;
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class SymbolicFunctionVM method CALLER_STACK_PARAM.
@Override
public void CALLER_STACK_PARAM(int nr, int calleeLocalsIndex, byte conc_arg) {
if (functionUnderExecution != null) {
IntegerValue symb_arg = getIntegerExprFromStack(nr);
functionUnderExecution.setParam(nr, conc_arg, symb_arg);
beforeExecuteFunction(nr);
}
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class SymbolicFunctionVM method CALLER_STACK_PARAM.
@Override
public void CALLER_STACK_PARAM(int nr, int calleeLocalsIndex, short conc_arg) {
if (functionUnderExecution != null) {
IntegerValue symb_arg = getIntegerExprFromStack(nr);
functionUnderExecution.setParam(nr, conc_arg, symb_arg);
beforeExecuteFunction(nr);
}
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class BigInteger_DivideAndRemainder method executeFunction.
@Override
public Object executeFunction() {
BigInteger conc_left_big_integer = (BigInteger) this.getConcReceiver();
ReferenceConstant symb_left_big_integer = this.getSymbReceiver();
BigInteger conc_right_big_integer = (BigInteger) this.getConcArgument(0);
ReferenceConstant symb_right_big_integer = (ReferenceConstant) this.getSymbArgument(0);
Object res = this.getConcRetVal();
ReferenceExpression symb_res = this.getSymbRetVal();
if (res != null && conc_left_big_integer != null && conc_right_big_integer != null) {
IntegerValue left_big_integer_expr = this.env.heap.getField(Types.JAVA_MATH_BIG_INTEGER, SymbolicHeap.$BIG_INTEGER_CONTENTS, conc_left_big_integer, symb_left_big_integer, conc_left_big_integer.longValue());
IntegerValue right_big_integer_expr = this.env.heap.getField(Types.JAVA_MATH_BIG_INTEGER, SymbolicHeap.$BIG_INTEGER_CONTENTS, conc_right_big_integer, symb_right_big_integer, conc_right_big_integer.longValue());
if (left_big_integer_expr.containsSymbolicVariable() || right_big_integer_expr.containsSymbolicVariable()) {
// quotient
BigInteger conc_quotient = (BigInteger) Array.get(res, QUOTIENT_ARRAY_INDEX);
ReferenceConstant symb_quotient = (ReferenceConstant) this.env.heap.getReference(conc_quotient);
IntegerValue symb_div_value = ExpressionFactory.div(left_big_integer_expr, right_big_integer_expr, conc_quotient.longValue());
this.env.heap.putField(Types.JAVA_MATH_BIG_INTEGER, SymbolicHeap.$BIG_INTEGER_CONTENTS, conc_quotient, symb_quotient, symb_div_value);
// remainder
BigInteger conc_remainder = (BigInteger) Array.get(res, REMAINDER_ARRAY_INDEX);
ReferenceConstant symb_remainder = (ReferenceConstant) this.env.heap.getReference(conc_remainder);
IntegerValue symb_rem_value = ExpressionFactory.rem(left_big_integer_expr, right_big_integer_expr, conc_remainder.longValue());
this.env.heap.putField(Types.JAVA_MATH_BIG_INTEGER, SymbolicHeap.$BIG_INTEGER_CONTENTS, conc_remainder, symb_remainder, symb_rem_value);
}
}
return symb_res;
}
use of org.evosuite.symbolic.expr.bv.IntegerValue in project evosuite by EvoSuite.
the class RegionMatches5 method executeFunction.
@Override
public Object executeFunction() {
ReferenceConstant symb_receiver = (ReferenceConstant) this.getSymbReceiver();
String conc_receiver = (String) this.getConcReceiver();
StringValue stringReceiverExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_receiver, symb_receiver, conc_receiver);
IntegerValue ignoreCaseExpr = new IntegerConstant(0);
IntegerValue toffsetExpr = this.getSymbIntegerArgument(0);
ReferenceConstant symb_other = (ReferenceConstant) this.getSymbArgument(1);
String conc_other = (String) this.getConcArgument(1);
StringValue otherExpr = env.heap.getField(Types.JAVA_LANG_STRING, SymbolicHeap.$STRING_VALUE, conc_other, symb_other, conc_other);
IntegerValue ooffsetExpr = this.getSymbIntegerArgument(2);
IntegerValue lenExpr = this.getSymbIntegerArgument(3);
boolean res = this.getConcBooleanRetVal();
if (stringReceiverExpr.containsSymbolicVariable() || ignoreCaseExpr.containsSymbolicVariable() || toffsetExpr.containsSymbolicVariable() || otherExpr.containsSymbolicVariable() || ooffsetExpr.containsSymbolicVariable() || lenExpr.containsSymbolicVariable()) {
ArrayList<Expression<?>> other = new ArrayList<Expression<?>>();
other.add(toffsetExpr);
other.add(ooffsetExpr);
other.add(lenExpr);
other.add(ignoreCaseExpr);
int conV = res ? 1 : 0;
StringMultipleComparison strComp = new StringMultipleComparison(stringReceiverExpr, Operator.REGIONMATCHES, otherExpr, other, (long) conV);
return strComp;
}
return this.getSymbIntegerRetVal();
}
Aggregations