本文整理汇总了Java中soot.jimple.IdentityStmt.getLeftOp方法的典型用法代码示例。如果您正苦于以下问题:Java IdentityStmt.getLeftOp方法的具体用法?Java IdentityStmt.getLeftOp怎么用?Java IdentityStmt.getLeftOp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.jimple.IdentityStmt
的用法示例。
在下文中一共展示了IdentityStmt.getLeftOp方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
Value l = stmt.getLeftOp();
Value r = stmt.getRightOp();
if (l instanceof Local) {
if (((Local) l).getType() instanceof IntegerType) {
TypeNode left = ClassHierarchy.v().typeNode(
(((Local) l).getType()));
TypeNode right = ClassHierarchy.v().typeNode(r.getType());
if (!right.hasAncestor_1(left)) {
if (fix) {
((soot.jimple.internal.JIdentityStmt) stmt)
.setLeftOp(insertCastAfter((Local) l,
getTypeForCast(left),
getTypeForCast(right), stmt));
} else {
error("Type Error(16)");
}
}
}
}
}
示例2: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
Value l = stmt.getLeftOp();
Value r = stmt.getRightOp();
if (l instanceof Local) {
TypeVariable left = resolver.typeVariable((Local) l);
if (!(r instanceof CaughtExceptionRef)) {
TypeVariable right = resolver.typeVariable(r.getType());
right.addParent(left);
} else {
List<RefType> exceptionTypes = TrapManager.getExceptionTypesOf(stmt, stmtBody);
Iterator<RefType> typeIt = exceptionTypes.iterator();
while (typeIt.hasNext()) {
Type t = typeIt.next();
resolver.typeVariable(t).addParent(left);
}
if (uses) {
left.addParent(resolver.typeVariable(RefType.v("java.lang.Throwable")));
}
}
}
}
示例3: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseIdentityStmt(IdentityStmt stmt) {
Value lhs = stmt.getLeftOp();
Value rhs = stmt.getRightOp();
if (rhs instanceof CaughtExceptionRef) {
// save the caught exception with move-exception
Register localReg = regAlloc.asLocal(lhs);
addInsn(new Insn11x(Opcode.MOVE_EXCEPTION, localReg), stmt);
this.insnRegisterMap.put(insns.get(insns.size() - 1), LocalRegisterAssignmentInformation.v(localReg, (Local)lhs));
} else if (rhs instanceof ThisRef || rhs instanceof ParameterRef) {
/*
* do not save the ThisRef or ParameterRef in a local, because it always has a parameter register already.
* at least use the local for further reference in the statements
*/
Local localForThis = (Local) lhs;
regAlloc.asParameter(belongingMethod, localForThis);
parameterInstructionsList.add(LocalRegisterAssignmentInformation.v(regAlloc.asLocal(localForThis).clone(), localForThis));
} else {
throw new Error("unknown Value as right-hand side of IdentityStmt: " + rhs);
}
}
示例4: getParameterLocal
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/** Return LHS of the first identity stmt assigning from \@parameter i. **/
public Local getParameterLocal(int i)
{
for (Unit s : getUnits())
{
if (s instanceof IdentityStmt &&
((IdentityStmt)s).getRightOp() instanceof ParameterRef)
{
IdentityStmt is = (IdentityStmt)s;
ParameterRef pr = (ParameterRef)is.getRightOp();
if (pr.getIndex() == i)
return (Local)is.getLeftOp();
}
}
throw new RuntimeException("couldn't find parameterref" + i +"! in "+getMethod());
}
示例5: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public final void caseIdentityStmt(IdentityStmt s) {
statement = s;
Value lhs = s.getLeftOp();
Value rhs = s.getRightOp();
if( !( lhs.getType() instanceof RefType )
&& !(lhs.getType() instanceof ArrayType ) ) {
caseUninterestingStmt( s );
return;
}
Local llhs = (Local) lhs;
if( rhs instanceof CaughtExceptionRef ) {
caseCatchStmt( llhs, (CaughtExceptionRef) rhs );
} else {
IdentityRef rrhs = (IdentityRef) rhs;
caseIdentityStmt( llhs, rrhs );
}
}
示例6: findparamlocal
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findparamlocal(PatchingChain<Unit> units) {
// TODO HACK! assume the second identity stmt is always for the required
// parameter
boolean thislocalseen = false;
for (Unit unit : units)
{
if (unit instanceof IdentityStmt)
{
if (thislocalseen)
{
IdentityStmt istmt = (IdentityStmt) unit;
return (Local) istmt.getLeftOp();
}
else
{
thislocalseen = true;
}
}
}
throw new RuntimeException("Parameter Local not found (maybe method has no parameters?)");
}
示例7: findsecondparamlocal
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findsecondparamlocal(PatchingChain<Unit> units)
{
// TODO HACK! assume the second identity stmts are in the order
// "this","param1","param2"...
int localsseen = 0;
for (Unit unit : units)
{
if (unit instanceof IdentityStmt)
{
if (localsseen == 2)
{
IdentityStmt istmt = (IdentityStmt) unit;
return (Local) istmt.getLeftOp();
}
localsseen++;
}
}
throw new RuntimeException("Parameter Local not found (maybe method has no parameters?)");
}
示例8: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public void caseIdentityStmt(IdentityStmt stmt) {
Value l = stmt.getLeftOp();
Value r = stmt.getRightOp();
if (l instanceof Local) {
if (((Local) l).getType() instanceof IntegerType) {
TypeVariable left = resolver.typeVariable((Local) l);
TypeVariable right = resolver.typeVariable(r.getType());
right.addParent(left);
}
}
}
示例9: findthislocal
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
public static Local findthislocal(Chain<Unit> units)
{
// TODO: HACK! assume the first identity stmt is always for 'this'
for (Unit unit : units)
{
if (unit instanceof IdentityStmt)
{
IdentityStmt istmt = (IdentityStmt) unit;
return (Local) istmt.getLeftOp();
}
}
return null;
}
示例10: caseInvokeStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
@Override
public void caseInvokeStmt(InvokeStmt stmt) {
InvokeExpr invokeExpr = stmt.getInvokeExpr();
SootClass declaringClass = invokeExpr.getMethod().getDeclaringClass();
if(exprVisitor.isExpressionThatNeedsToBeConvertedToSMT(invokeExpr))
exprVisitor.convertSpecialExpressionsToSMT(invokeExpr, stmt);
else if(UtilInstrumenter.isAppDeveloperCode(declaringClass)) {
SootMethod method = invokeExpr.getMethod();
Body body = method.retrieveActiveBody();
SMTBinding newRhs = getBindingForTaintedValue(stmt);
//if there is no taint-tracking involved (newRhs == null), we do not have to do anything here
if(newRhs == null)
return;
int indexOfInterest = -1;
for(int i = 0; i < invokeExpr.getArgCount(); i++) {
if(newRhs.getVariableName().equals(invokeExpr.getArg(i).toString())) {
indexOfInterest = i;
break;
}
}
if(indexOfInterest == -1)
return;
for(Unit unit : body.getUnits()) {
if(unit instanceof IdentityStmt) {
IdentityStmt identity = (IdentityStmt)unit;
Value rhs = identity.getRightOp();
if(rhs instanceof ParameterRef) {
ParameterRef param = (ParameterRef)rhs;
if(param.getIndex() == indexOfInterest) {
Value lhs = identity.getLeftOp();
SMTBinding newLhs = createNewBindingForValue(lhs);
addValueBindingToVariableDeclaration(lhs, newLhs);
SMTSimpleAssignment simpleAssignment = new SMTSimpleAssignment(newLhs, new SMTBindingValue(newRhs));
SMTAssertStatement assignmentAssert = new SMTAssertStatement(simpleAssignment);
addAssertStmtToAllPrograms(assignmentAssert);
}
}
}
}
}
else {
System.err.println(String.format("Double-Check if the following method contains useful information which can be extracted: \n%s", stmt));
}
}
示例11: updateNewBody
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
private void updateNewBody(Body b) {
SootClass servicesInitClass = Scene.v().getSootClass(
servicesInitClassName);
// since method is static, just remove first statement if necessary
// // change reference to @this type
// Unit first = b.getUnits().getFirst();
// if (!(first instanceof IdentityStmt))
// throw new
// RuntimeException("error: first statement not instance of IdentityStmt: "+
// first);
// IdentityStmt idstmt = (IdentityStmt)first;
// Local left = (Local) idstmt.getLeftOp();
// Value right = idstmt.getRightOp();
// RefType t = servicesInitClass.getType();
// ThisRef newThisRef = Jimple.v().newThisRef(t);
// left.setType(t);
// Unit newIdentityStmt = Jimple.v().newIdentityStmt(left, newThisRef);
// b.getUnits().swapWith(first, newIdentityStmt);
b.getUnits().removeFirst();
//
// if context parameter is present redirect it
Unit second = b.getUnits().getFirst(); // .getSuccOf(newIdentityStmt);
if (second instanceof IdentityStmt) {
IdentityStmt pStmt = (IdentityStmt) second;
Local l = (Local) pStmt.getLeftOp();
Value r = pStmt.getRightOp();
SootField sf = servicesInitClass
.getFieldByName("androidcontentContext");
Value newR = Jimple.v().newStaticFieldRef(sf.makeRef());
AssignStmt newStmt = Jimple.v().newAssignStmt(l, newR);
b.getUnits().swapWith(pStmt, newStmt);
}
// redirect getService methods
RedirectService rs = new RedirectService();
List<Unit> getSystemService = rs.hasCallToGetSystem(b);
if (getSystemService.size() != 0) {
System.out.println("redirecting getService for body");
List<String> servicesCalled = ServiceMapper.v().getServiceNames(b,
getSystemService);
rs.redirectGetSystemServiceCalls(b, getSystemService,
servicesCalled, servicesInitClass);
}
redirectContextFieldAssignments(b);
checkUsageofR0(b);
}
示例12: caseIdentityStmt
import soot.jimple.IdentityStmt; //导入方法依赖的package包/类
/**
* Method, which should process the given statement of type
* {@link IdentityStmt}. Therefore the method looks up the
* <em>security level</em> of the right hand side (the level depends on the
* annotation if it is a parameter reference, but if it is a this reference,
* then the level is the weakest available <em>security level</em>). For the
* assignment of parameter to a local variable also the name and type of
* them are checked.
*
* @param stmt
* Statement that should be processed to check for security
* violations.
* @see soot.jimple.StmtSwitch#caseIdentityStmt(soot.jimple.IdentityStmt)
*/
@Override
public void caseIdentityStmt(IdentityStmt stmt) {
Value left = stmt.getLeftOp();
Value right = stmt.getRightOp();
updateIdentityLevel(right, left, stmt.toString());
}