本文整理汇总了Java中soot.tagkit.BytecodeOffsetTag类的典型用法代码示例。如果您正苦于以下问题:Java BytecodeOffsetTag类的具体用法?Java BytecodeOffsetTag怎么用?Java BytecodeOffsetTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BytecodeOffsetTag类属于soot.tagkit包,在下文中一共展示了BytecodeOffsetTag类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTags
import soot.tagkit.BytecodeOffsetTag; //导入依赖的package包/类
/**
* Tag the passed host with: - this instructions line number (if one is set)
* - the original bytecode offset
*
* @param host
* the host to tag
*/
protected void addTags(Host host) {
if (lineNumber != -1) {
host.addTag(new LineNumberTag(lineNumber));
host.addTag(new SourceLineNumberTag(lineNumber));
}
host.addTag(new BytecodeOffsetTag(codeAddress));
}
示例2: 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;
}
示例3: 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;
}
示例4: 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);
}
}
}