本文整理汇总了Java中soot.tagkit.BytecodeOffsetTag.getBytecodeOffset方法的典型用法代码示例。如果您正苦于以下问题:Java BytecodeOffsetTag.getBytecodeOffset方法的具体用法?Java BytecodeOffsetTag.getBytecodeOffset怎么用?Java BytecodeOffsetTag.getBytecodeOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.tagkit.BytecodeOffsetTag
的用法示例。
在下文中一共展示了BytecodeOffsetTag.getBytecodeOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBCI
import soot.tagkit.BytecodeOffsetTag; //导入方法依赖的package包/类
public static int getBCI(Unit u){
try{
BytecodeOffsetTag bci = (BytecodeOffsetTag)u.getTag("BytecodeOffsetTag");
return bci.getBytecodeOffset();
}catch(Exception e){
if (Config.verbose >= 2)
System.out.println("WARN: SootUtilities cannot get BCI"+u);
}
return -1;
}
示例2: ProgramPoint
import soot.tagkit.BytecodeOffsetTag; //导入方法依赖的package包/类
/**
* Constructor
* @param method
* @param stmt
*/
public ProgramPoint(SootMethod method, Stmt stmt) {
BytecodeOffsetTag tag = (BytecodeOffsetTag) stmt.getTag("BytecodeOffsetTag");
offset = (tag == null) ? -1 : tag.getBytecodeOffset();
this.method = method;
this.stmt = stmt;
}
示例3: run
import soot.tagkit.BytecodeOffsetTag; //导入方法依赖的package包/类
@Override
public void run(SpyResult result, AppDescription app) {
Scene scene = Scene.v();
int count = 0;
Iterator<SootClass> classes = scene.getApplicationClasses().iterator();
while(classes.hasNext()) {
SootClass clazz = classes.next();
for (SootMethod method : clazz.getMethods()) {
if(!method.hasActiveBody()) continue;
Body body = method.getActiveBody();
Chain<Unit> code = body.getUnits();
Iterator<Trap> traps = body.getTraps().iterator();
while(traps.hasNext()) {
boolean bogus = false;
Trap trap = traps.next();
Unit lastOfCatch = trap.getEndUnit();
// System.err.println("Last of catch " + lastOfCatch);
Unit firstHandler = trap.getHandlerUnit();
// System.err.println("First of handler " + firstHandler);
Unit nextHandler = code.getSuccOf(firstHandler);
// System.err.println("Next handler " + nextHandler);
if (nextHandler == null) continue;
Unit handlerTarget = seekTarget(nextHandler);
if (handlerTarget == null) continue;
// System.err.println("handler goto " + handlerTarget + handlerTarget.getClass());
if (handlerTarget instanceof ReturnVoidStmt) {
bogus = true;
} else if (lastOfCatch instanceof GotoStmt) {
bogus = handlerTarget.equals(seekTarget(lastOfCatch));
} else {
if (!lastOfCatch.fallsThrough()) continue;
Unit targetCatch = code.getSuccOf(lastOfCatch);
if (targetCatch == null) continue; // This had to be a return.
// System.err.println("Target 1" + targetCatch);
if (handlerTarget.equals(targetCatch)) bogus = true;
if (targetCatch.fallsThrough() && !targetCatch.branches()) {
targetCatch = code.getSuccOf(targetCatch);
// System.err.println("Target 2" + targetCatch);
if (handlerTarget.equals(targetCatch)) bogus = true;
}
}
// System.err.println(bogus);
if (bogus) {
BytecodeOffsetTag tag = (BytecodeOffsetTag) firstHandler.getTag("BytecodeOffsetTag");
int offset = (tag == null) ? -1 : tag.getBytecodeOffset();
result.setCustomResult(listItem("android.empty.exception.class",count),clazz.getName());
result.setCustomResult(listItem("android.empty.exception.method",count),method.getSubSignature());
result.setCustomResult(listItem("android.empty.exception.pos",count),offset);
count++;
}
}
result.setCustomResult("android.empty.exception.error", count > 0);
result.setCustomResult("android.empty.exception.count", count);
}
}
}