soot.Body.getMethod()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中soot.Body.getMethod()方法的一些代码示例,展示了Body.getMethod()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.getMethod()方法的具体详情如下:
包路径:soot.Body
类名称:Body
方法名:getMethod

Body.getMethod介绍

[英]Returns the method associated with this Body.
[中]返回与此正文关联的方法。

代码示例

代码示例来源:origin: Sable/soot

@Override
public SootMethod getMethodOf(Unit u) {
 assert unitToOwner.containsKey(u) : "Statement " + u + " not in unit-to-owner mapping";
 Body b = unitToOwner.get(u);
 return b == null ? null : b.getMethod();
}

代码示例来源:origin: Sable/soot

public LockableReferenceAnalysis(UnitGraph g) {
 super(g);
 graph = g;
 method = g.getBody().getMethod();
 contributingRWSet = null;
 tn = null;
 begin = null;
 lostObjects = false;
 refToBase = new HashMap<Ref, EquivalentValue>();
 refToIndex = new HashMap<Ref, EquivalentValue>();
 // analysis is done on-demand, not now
}

代码示例来源:origin: Sable/soot

protected void internalTransform(Body body, String phaseName, Map<String, String> options) {
  soot.jbco.Main.methods2JLocals.put(body.getMethod(), new ArrayList<Local>(body.getLocals()));
 }
}

代码示例来源:origin: Sable/soot

/** Return unit containing the \@this-assignment **/
public Unit getThisUnit() {
 for (Unit u : getUnits()) {
  if (u instanceof IdentityStmt && ((IdentityStmt) u).getRightOp() instanceof ThisRef) {
   return u;
  }
 }
 throw new RuntimeException("couldn't find this-assignment!" + " in " + getMethod());
}

代码示例来源:origin: Sable/soot

@Override
 public void caseReturnStmt(ReturnStmt stmt) {
  usedAsFloatingPoint = stmt.getOp() == l && isFloatingPointLike(body.getMethod().getReturnType());
  doBreak = true;
  return;
 }
});

代码示例来源:origin: Sable/soot

@Override
public void validate(Body body, List<ValidationException> exception) {
 for (Local l : body.getLocals()) {
  if (l.getType() instanceof VoidType) {
   exception.add(new ValidationException(l, "Local " + l + " in " + body.getMethod() + " defined with void type"));
  }
 }
}

代码示例来源:origin: Sable/soot

/**
 * performs critical edge-removing.
 */
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
 if (Options.v().verbose()) {
  logger.debug("[" + b.getMethod().getName() + "]     Removing Critical Edges...");
 }
 removeCriticalEdges(b);
 if (Options.v().verbose()) {
  logger.debug("[" + b.getMethod().getName() + "]     Removing Critical Edges done.");
 }
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 usedAsObject = stmt.getOp() == l && isObject(body.getMethod().getReturnType());
 if (usedAsObject) {
  doBreak = true;
 }
 return;
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 usedAsObject = stmt.getOp() == l && isObject(body.getMethod().getReturnType());
 doBreak = true;
 return;
}

代码示例来源:origin: Sable/soot

private void validateLocal(Body body, ValueBox vb, List<ValidationException> exception) {
 Value value;
 if ((value = vb.getValue()) instanceof Local) {
  if (!body.getLocals().contains(value)) {
   exception.add(new ValidationException(value, "Local not in chain : " + value + " in " + body.getMethod()));
  }
 }
}

代码示例来源:origin: Sable/soot

private void printStatementsInBody(Body body, java.io.PrintWriter out) {
 if (Options.v().verbose()) {
  System.out.println("Printing " + body.getMethod().getName());
 }
 Chain<Unit> units = ((DavaBody) body).getUnits();
 if (units.size() != 1) {
  throw new RuntimeException("DavaBody AST doesn't have single root.");
 }
 UnitPrinter up = new DavaUnitPrinter((DavaBody) body);
 ((ASTNode) units.getFirst()).toString(up);
 out.print(up.toString());
}

代码示例来源:origin: Sable/soot

@Override
/** Verifies that the UnitBoxes of this Body all point to a Unit contained within this body. */
public void validate(Body body, List<ValidationException> exception) {
 for (UnitBox ub : body.getAllUnitBoxes()) {
  if (!body.getUnits().contains(ub.getUnit())) {
   throw new RuntimeException(
     "Unitbox points outside unitChain! to unit : " + ub.getUnit() + " in " + body.getMethod());
  }
 }
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 // add constraint
 DalvikTyper.v().setType(stmt.getOpBox(), b.getMethod().getReturnType(), true);
}

代码示例来源:origin: Sable/soot

protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
 initialize(options);
 SootMethod meth = b.getMethod();
 if ((methodsToPrint == null) || (meth.getDeclaringClass().getName() == methodsToPrint.get(meth.getName()))) {
  Body body = ir.getBody((JimpleBody) b);
  print_cfg(body);
 }
}

代码示例来源:origin: Sable/soot

protected Object newInitialFlow() {
  ArraySparseSet set = new ArraySparseSet();
  CallGraph cg = Scene.v().getCallGraph();

  Iterator mIt = cg.edgesOutOf(g.getBody().getMethod());
  while (mIt.hasNext()) {
   Edge edge = (Edge) mIt.next();
   if (edge.isClinit()) {
    set.add(edge.tgt());
   }
  }

  return set;
 }
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 if (stmt.getOp() instanceof UntypedConstant) {
  UntypedConstant uc = (UntypedConstant) stmt.getOp();
  Type type = b.getMethod().getReturnType();
  stmt.setOp(uc.defineType(type));
 }
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 if (stmt.getOp() instanceof UntypedConstant) {
  UntypedConstant uc = (UntypedConstant) stmt.getOp();
  Type type = b.getMethod().getReturnType();
  stmt.setOp(uc.defineType(type));
 }
}

代码示例来源:origin: Sable/soot

@Override
public void caseReturnStmt(ReturnStmt stmt) {
 if (stmt.getOp() instanceof IntConstant && isObject(body.getMethod().getReturnType())) {
  IntConstant iconst = (IntConstant) stmt.getOp();
  assert iconst.value == 0;
  stmt.setOp(nullConstant);
 }
}

代码示例来源:origin: Sable/soot

public void handleNewAnalysis(Transform t, Body b) {
 // here save current phase name and only send if actual data flow analysis exists
 if (PhaseOptions.getBoolean(PhaseOptions.v().getPhaseOptions(t.getPhaseName()), "enabled")) {
  String name = t.getPhaseName() + " for method: " + b.getMethod().getName();
  currentPhaseName(name);
  currentPhaseEnabled(true);
  doneCurrent(false);
 } else {
  currentPhaseEnabled(false);
  setInteractThisAnalysis(false);
 }
}

代码示例来源:origin: Sable/soot

protected void checkThrow(Body b, ThrowStmt ts) {
 if (isThrowDeclared(b, ((RefType) ts.getOp().getType()).getSootClass()) || isThrowFromCompiler(ts)
   || isExceptionCaught(b, ts, (RefType) ts.getOp().getType())) {
  return;
 }
 if (reporter != null) {
  reporter.reportError(new ExceptionCheckerError(b.getMethod(), ((RefType) ts.getOp().getType()).getSootClass(), ts,
    (SourceLnPosTag) ts.getOpBox().getTag("SourceLnPosTag")));
 }
}

相关文章