本文整理汇总了Java中soot.jimple.toolkits.callgraph.ReachableMethods.update方法的典型用法代码示例。如果您正苦于以下问题:Java ReachableMethods.update方法的具体用法?Java ReachableMethods.update怎么用?Java ReachableMethods.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.jimple.toolkits.callgraph.ReachableMethods
的用法示例。
在下文中一共展示了ReachableMethods.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMethodsForSeeds
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入方法依赖的package包/类
private Collection<SootMethod> getMethodsForSeeds(IInfoflowCFG icfg) {
List<SootMethod> seeds = new LinkedList<SootMethod>();
// If we have a callgraph, we retrieve the reachable methods. Otherwise,
// we have no choice but take all application methods as an approximation
if (Scene.v().hasCallGraph()) {
List<MethodOrMethodContext> eps = new ArrayList<MethodOrMethodContext>(Scene.v().getEntryPoints());
ReachableMethods reachableMethods = new ReachableMethods(Scene.v().getCallGraph(), eps.iterator(), null);
reachableMethods.update();
for (Iterator<MethodOrMethodContext> iter = reachableMethods.listener(); iter.hasNext();)
seeds.add(iter.next().method());
}
else {
long beforeSeedMethods = System.nanoTime();
Set<SootMethod> doneSet = new HashSet<SootMethod>();
for (SootMethod sm : Scene.v().getEntryPoints())
getMethodsForSeedsIncremental(sm, doneSet, seeds, icfg);
logger.info("Collecting seed methods took {} seconds", (System.nanoTime() - beforeSeedMethods) / 1E9);
}
return seeds;
}
示例2: analyzeRechableMethods
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入方法依赖的package包/类
private void analyzeRechableMethods(SootClass lifecycleElement, List<MethodOrMethodContext> methods) {
ReachableMethods rm = new ReachableMethods(Scene.v().getCallGraph(), methods);
rm.update();
// Scan for listeners in the class hierarchy
Iterator<MethodOrMethodContext> reachableMethods = rm.listener();
while (reachableMethods.hasNext()) {
SootMethod method = reachableMethods.next().method();
analyzeMethodForCallbackRegistrations(lifecycleElement, method);
analyzeMethodForDynamicBroadcastReceiver(method);
}
}
示例3: trackableFields
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入方法依赖的package包/类
/**
* Computes the set of {@link EquivalentValue}s of all field references that are used
* in this method but not set by the method or any method transitively called by this method.
*/
private Set<Value> trackableFields() {
Set<Value> usedFieldRefs = new HashSet<Value>();
//add all field references that are in use boxes
for (Unit unit : this.graph) {
Stmt s = (Stmt) unit;
List<ValueBox> useBoxes = s.getUseBoxes();
for (ValueBox useBox : useBoxes) {
Value val = useBox.getValue();
if(val instanceof FieldRef) {
FieldRef fieldRef = (FieldRef) val;
if(fieldRef.getType() instanceof RefLikeType)
usedFieldRefs.add(new EquivalentValue(fieldRef));
}
}
}
//prune all fields that are written to
if(!usedFieldRefs.isEmpty()) {
if(!Scene.v().hasCallGraph()) {
throw new IllegalStateException("No call graph found!");
}
CallGraph cg = Scene.v().getCallGraph();
ReachableMethods reachableMethods = new ReachableMethods(cg,Collections.<MethodOrMethodContext>singletonList(container));
reachableMethods.update();
for (Iterator<MethodOrMethodContext> iterator = reachableMethods.listener(); iterator.hasNext();) {
SootMethod m = (SootMethod) iterator.next();
if(m.hasActiveBody() &&
//exclude static initializer of same class (assume that it has already been executed)
!(m.getName().equals(SootMethod.staticInitializerName) && m.getDeclaringClass().equals(container.getDeclaringClass()))) {
for (Unit u : m.getActiveBody().getUnits()) {
List<ValueBox> defBoxes = u.getDefBoxes();
for (ValueBox defBox : defBoxes) {
Value value = defBox.getValue();
if(value instanceof FieldRef) {
usedFieldRefs.remove(new EquivalentValue(value));
}
}
}
}
}
}
return usedFieldRefs;
}
示例4: print
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入方法依赖的package包/类
@Override
public void print(PropagationSolver solver) {
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
String newLine = System.getProperty("line.separator");
List<MethodOrMethodContext> eps =
new ArrayList<MethodOrMethodContext>(Scene.v().getEntryPoints());
ReachableMethods reachableMethods =
new ReachableMethods(Scene.v().getCallGraph(), eps.iterator(), null);
reachableMethods.update();
for (Iterator<MethodOrMethodContext> iter = reachableMethods.listener(); iter.hasNext();) {
SootMethod ep = iter.next().method();
if (!ep.isConcrete() || !ep.hasActiveBody()
// || ep.getName().contains("dummy")
/* || Model.v().isExcludedClass(ep.getDeclaringClass().getName()) */) {
continue;
}
writer.write(ep.getActiveBody() + newLine);
writer.write("----------------------------------------------" + newLine);
writer.write("At end of: " + ep.getSignature() + newLine);
writer.write("Variables:" + newLine);
writer.write("----------------------------------------------" + newLine);
for (Unit ret : ep.getActiveBody().getUnits()) {
for (Map.Entry<Value, BasePropagationValue> l : solver.resultsAt(ret).entrySet()) {
Value symbol = l.getKey();
if (filter.filterOut(symbol)) {
continue;
}
writer.write(symbol + " contains value " + l.getValue() + newLine);
}
writer.write("**" + ret + newLine);
}
}
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}