• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NopStmt类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中soot.jimple.NopStmt的典型用法代码示例。如果您正苦于以下问题:Java NopStmt类的具体用法?Java NopStmt怎么用?Java NopStmt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NopStmt类属于soot.jimple包,在下文中一共展示了NopStmt类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: instrumentEachBranchAccess

import soot.jimple.NopStmt; //导入依赖的package包/类
private void instrumentEachBranchAccess(Body body, Unit unit){
	SootClass sootClass = Scene.v().getSootClass(
			UtilInstrumenter.JAVA_CLASS_FOR_PATH_INSTRUMENTATION);
	
	// Create the method invocation
	SootMethod createAndAdd = sootClass.getMethod("reportConditionOutcomeSynchronous",
			Collections.<Type>singletonList(BooleanType.v()));
	StaticInvokeExpr sieThen = Jimple.v().newStaticInvokeExpr(
			createAndAdd.makeRef(), IntConstant.v(1));
	StaticInvokeExpr sieElse = Jimple.v().newStaticInvokeExpr(
			createAndAdd.makeRef(), IntConstant.v(0));
	Unit sieThenUnit = Jimple.v().newInvokeStmt(sieThen);
	sieThenUnit.addTag(new InstrumentedCodeTag());
	Unit sieElseUnit = Jimple.v().newInvokeStmt(sieElse);
	sieElseUnit.addTag(new InstrumentedCodeTag());
	
	//treatment of target statement ("true"-branch)
	IfStmt ifStmt = (IfStmt)unit;
	Stmt targetStmt = ifStmt.getTarget();
	if(!branchTargetStmt.contains(targetStmt.toString())) {
		branchTargetStmt.add(sieThenUnit.toString());
		body.getUnits().insertBefore(sieThenUnit, targetStmt);
		
		NopStmt nop = Jimple.v().newNopStmt();
		GotoStmt gotoNop = Jimple.v().newGotoStmt(nop);
		body.getUnits().insertBeforeNoRedirect(nop, targetStmt);
		body.getUnits().insertBeforeNoRedirect(gotoNop, sieThenUnit);
	}
	
	
	//treatment of "else"-branch
	body.getUnits().insertAfter(sieElseUnit, unit);
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:34,代码来源:ConditionTracking.java


示例2: internalTransform

import soot.jimple.NopStmt; //导入依赖的package包/类
/** Removes {@link NopStmt}s from the passed body (which must be
a {@link JimpleBody}).  Complexity is linear 
       with respect to the statements.
   */
   
   protected void internalTransform(Body b, String phaseName, Map<String, String> options)
   {
       JimpleBody body = (JimpleBody)b;
       
       if(Options.v().verbose())
           G.v().out.println("[" + body.getMethod().getName() +
               "] Removing nops...");
               
       Chain<Unit> units = body.getUnits();
       
       // Just do one trivial pass.
       {
           Iterator<Unit> stmtIt = units.snapshotIterator();
           
           while(stmtIt.hasNext()) 
           {
               Unit u = stmtIt.next();
			if (u instanceof NopStmt) {
				// Hack: do not remove nop, if is is used for a Trap which
				// is at the very end of the code.
				boolean keepNop = false;
				if (b.getUnits().getLast() == u) {
					for (Trap t : b.getTraps()) {
						if (t.getEndUnit() == u) {
							keepNop = true;
						}
					}
				}
				if (!keepNop) {
					units.remove(u);
				}
			}
           }
       }
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:41,代码来源:NopEliminator.java


示例3: insertNopStatements

import soot.jimple.NopStmt; //导入依赖的package包/类
private static void insertNopStatements() {
	for (Iterator<MethodOrMethodContext> iter = Scene.v().getReachableMethods().listener(); iter.hasNext();) {
		SootMethod m = iter.next().method();
		if (m.hasActiveBody()) {
			Body b = m.getActiveBody();
			NopStmt newNopStmt = Jimple.v().newNopStmt();
			newNopStmt.addAllTagsOf(b.getUnits().getFirst());
			b.getUnits().addFirst(newNopStmt);

			ActiveBodyVerifier.markActive(m);
		} else
			ActiveBodyVerifier.markInactive(m);
	}
}
 
开发者ID:johanneslerch,项目名称:FlowTwist,代码行数:15,代码来源:AbstractAnalysis.java


示例4: instrumentOnKey

import soot.jimple.NopStmt; //导入依赖的package包/类
private static void instrumentOnKey(SootClass activity, String methodSubSignature, SootMethod toCall)
{
    SootMethod method;
    try
    {
        method = activity.getMethod(methodSubSignature);
    } catch (RuntimeException e)
    {
        throw new RuntimeException("Method not found: " + methodSubSignature + " in class: " + activity.getJavaStyleName() + "\n" + e.getMessage());
    }
    method.setModifiers(method.getModifiers() & (~Modifier.FINAL));
    Body body = method.retrieveActiveBody();
    Chain<Unit> toInsert = new HashChain<Unit>();
    Local thislocal = Util.findthislocal(body.getUnits());
    Local firstparam = Util.findparamlocal(body.getUnits());
    Local secondparam = Util.findsecondparamlocal(body.getUnits());

    Local returnvalue = Jimple.v().newLocal("returnvalue", BooleanType.v());
    body.getLocals().add(returnvalue);
    toInsert.add(Jimple.v().
            newAssignStmt(returnvalue, Jimple.v().
                    newStaticInvokeExpr(toCall.makeRef(), thislocal, firstparam, secondparam)));

    NopStmt jumpTarget = Jimple.v().newNopStmt();
    toInsert.add(Jimple.v().
            newIfStmt(Jimple.v().
                    newEqExpr(
                            returnvalue,
                            IntConstant.v(0)), jumpTarget));
    toInsert.add(Jimple.v().newReturnStmt(returnvalue));
    toInsert.add(jumpTarget);
    Util.insertAfterIdentityStmt(body.getUnits(), toInsert);
}
 
开发者ID:ravibhoraskar,项目名称:bladedroid,代码行数:34,代码来源:BladeDroid_Instrument.java


示例5: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt stmt) {
	throw new RuntimeException("todo");
	
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:6,代码来源:JimpleStmtVisitorImpl.java


示例6: unbalancedReturnFunction

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public Collection<? extends IPathEdge<Unit, AccessGraph>> unbalancedReturnFunction(
    IPathEdge<Unit, AccessGraph> currEdge, Unit callSite, Unit returnSite, SootMethod callee) {

  // Unbalanced return only occurs when the start statement of the path edge is not the first
  // statement of the method, i.e. a NopStmt
  if (currEdge.getStart() instanceof NopStmt) {
    return Collections.emptySet();
  }
  // Retrieve the backward edges associated with the forward edge
  Collection<IPathEdge<Unit, AccessGraph>> collection = fwToBwEdge.get(currEdge.getStartNode());
  if (collection == null)
    return Collections.emptySet();


  for (IPathEdge<Unit, AccessGraph> currBwEdge : collection) {
    if (context.getSubQuery() == null)
      return Collections.emptySet();
    // Retrieve the incoming set for the backward edges, to know, where the forward analysis can
    // return to in an unbalanced manner (forward analysis follows backward analysis, hence it
    // also should do so at returns.)
    Collection<IPathEdge<Unit, AccessGraph>> incomingMap =
        context.getSubQuery().backwardIncoming(currBwEdge.getStartNode(), callee);

    if (incomingMap == null)
      return Collections.emptySet();
    matchingAllocationIncomingEdge = new HashSet<>();
    // check that parentsolver has callSite in incomingMap, Otherwise we do not need to return;
    for (IPathEdge<Unit, AccessGraph> inc : incomingMap) {
      Unit callSiteOfAlloc = inc.getTarget();
      if (callSiteOfAlloc.equals(callSite)) {
        matchingAllocationIncomingEdge.add(inc);
        constructPath(inc);
      }
    }
  }
  // There was no incoming in the ASolver for the appropriate callSite.
  if (matchingAllocationIncomingEdge == null || matchingAllocationIncomingEdge.isEmpty()) {
    return Collections.emptySet();
  }
  return super.unbalancedReturnFunction(currEdge, callSite, returnSite, callee);

}
 
开发者ID:themaplelab,项目名称:boomerang,代码行数:44,代码来源:ForwardPathEdgeFunctions.java


示例7: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
public void caseNopStmt(NopStmt stmt) {
	printStmt(stmt);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:4,代码来源:StmtTemplatePrinter.java


示例8: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
public void caseNopStmt(NopStmt stmt) {
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:3,代码来源:ConstraintChecker.java


示例9: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt stmt) {
       addInsn(new Insn10x(Opcode.NOP), stmt);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:5,代码来源:StmtVisitor.java


示例10: insertIntermediateJump

import soot.jimple.NopStmt; //导入依赖的package包/类
/**
 * Creates an intermediate jump instruction between the original jump
 * instruction and its target
 * @param targetInsPos The jump target index
 * @param jumpInsPos The position of the jump instruction
 * @param stmtV The statement visitor used for constructing the instructions
 * @param instructions The list of Dalvik instructions
 * @param labelAssigner The label assigner to be used for creating new labels
 */
private void insertIntermediateJump(int targetInsPos, int jumpInsPos,
		StmtVisitor stmtV, List<BuilderInstruction> instructions,
		LabelAssigner labelAssigner) {
	// Get the original jump instruction
	BuilderInstruction originalJumpInstruction = instructions.get(jumpInsPos);
	Insn originalJumpInsn = stmtV.getInsnForInstruction(originalJumpInstruction);
	if (originalJumpInsn == null)
		return;
	if (!(originalJumpInsn instanceof InsnWithOffset))
		throw new RuntimeException("Unexpected jump instruction target");
	InsnWithOffset offsetInsn = (InsnWithOffset) originalJumpInsn;
	
	// Find a position where we can jump to
	int distance = Math.max(targetInsPos, jumpInsPos) - Math.min(targetInsPos, jumpInsPos);
	if (distance == 0)
		return;
	int newJumpIdx = Math.min(targetInsPos, jumpInsPos) + (distance / 2);
	int sign = (int) Math.signum(targetInsPos - jumpInsPos);
	if (distance > offsetInsn.getMaxJumpOffset())
		newJumpIdx = jumpInsPos + sign;
	
	// There must be a statement at the instruction after the jump target
	while (stmtV.getStmtForInstruction(instructions.get(newJumpIdx)) == null) {
		 newJumpIdx += sign;
		 if (newJumpIdx < 0 || newJumpIdx >= instructions.size())
			 throw new RuntimeException("No position for inserting intermediate "
					 + "jump instruction found");
	}
	
	// Create a jump instruction from the middle to the end
	NopStmt nop = Jimple.v().newNopStmt();
	Insn30t newJump = new Insn30t(Opcode.GOTO_32);
	newJump.setTarget(stmtV.getStmtForInstruction(instructions.get(targetInsPos)));
	BuilderInstruction newJumpInstruction = newJump.getRealInsn(labelAssigner);
	instructions.add(newJumpIdx, newJumpInstruction);
	stmtV.fakeNewInsn(nop, newJump, newJumpInstruction);
	
	// We have added something, so we need to fix indices
	if (newJumpIdx < jumpInsPos)
		jumpInsPos++;
	if (newJumpIdx < targetInsPos)
		targetInsPos++;
	
	// Jump from the original instruction to the new one in the middle
	offsetInsn.setTarget(nop);
	BuilderInstruction replacementJumpInstruction = offsetInsn.getRealInsn(labelAssigner);
	instructions.add(jumpInsPos, replacementJumpInstruction);
	instructions.remove(originalJumpInstruction);
	stmtV.fakeNewInsn(stmtV.getStmtForInstruction(originalJumpInstruction),
			originalJumpInsn, replacementJumpInstruction);
	
	// Our indices are still fine, because we just replaced something
	Stmt afterNewJump = stmtV.getStmtForInstruction(instructions.get(newJumpIdx + 1));
	
	// Make the original control flow jump around the new artificial jump instruction
	Insn10t jumpAround = new Insn10t(Opcode.GOTO);
	jumpAround.setTarget(afterNewJump);
	BuilderInstruction jumpAroundInstruction = jumpAround.getRealInsn(labelAssigner);
	instructions.add(newJumpIdx, jumpAroundInstruction);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:70,代码来源:DexPrinter.java


示例11: jimplify

import soot.jimple.NopStmt; //导入依赖的package包/类
public void jimplify (DexBody body) {
    NopStmt nop = Jimple.v().newNopStmt();
    setUnit(nop);
    addTags(nop);
    body.add(nop);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:7,代码来源:NopInstruction.java


示例12: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt s) {
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:4,代码来源:UnitThrowAnalysis.java


示例13: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt arg0) {
	injectLabelStatements(arg0);
	// Log.error("NopStmt: " + arg0.toString());
	// assert (false);
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:7,代码来源:SootStmtSwitch.java


示例14: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt stmt) {
}
 
开发者ID:proglang,项目名称:jgs,代码行数:4,代码来源:SecurityConstraintStmtSwitch.java


示例15: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
@Override
public void caseNopStmt(NopStmt stmt) {
	logger.fine("\n > > > Nop statement identified < < <");
}
 
开发者ID:proglang,项目名称:jgs,代码行数:5,代码来源:AnnotationStmtSwitch.java


示例16: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
/**
 * DOC
 * 
 * @see soot.jimple.StmtSwitch#caseNopStmt(soot.jimple.NopStmt)
 */
@Override
public void caseNopStmt(NopStmt stmt) {
}
 
开发者ID:proglang,项目名称:jgs,代码行数:9,代码来源:AnnotationStmtSwitch.java


示例17: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
/**
 * Method, which should process the given statement of type {@link NopStmt}.
 * In this case, there is no reason to check the statement in more detail.
 * Because of that nothing will be done for a nop statement.
 * 
 * @param stmt
 *            Statement that should be processed to check for security
 *            violations.
 * @see soot.jimple.StmtSwitch#caseNopStmt(soot.jimple.NopStmt)
 */
@Override
public void caseNopStmt(NopStmt stmt) {
    // Nothing to do in case of a nop stmt
}
 
开发者ID:proglang,项目名称:jgs,代码行数:15,代码来源:SecurityLevelStmtSwitch.java


示例18: caseNopStmt

import soot.jimple.NopStmt; //导入依赖的package包/类
public void caseNopStmt(NopStmt stmt) { } 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:2,代码来源:UseChecker.java



注:本文中的soot.jimple.NopStmt类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Import类代码示例发布时间:2022-05-22
下一篇:
Java AffineTransform3D类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap