本文整理汇总了Java中soot.jimple.toolkits.callgraph.ReachableMethods类的典型用法代码示例。如果您正苦于以下问题:Java ReachableMethods类的具体用法?Java ReachableMethods怎么用?Java ReachableMethods使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReachableMethods类属于soot.jimple.toolkits.callgraph包,在下文中一共展示了ReachableMethods类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:21,代码来源:Infoflow.java
示例2: computeSeeds
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
private Set<PathEdge<Unit, WrappedAccessGraph>> computeSeeds() {
Set<PathEdge<Unit, WrappedAccessGraph>> seeds = new HashSet<>();
ReachableMethods rm = Scene.v().getReachableMethods();
QueueReader<MethodOrMethodContext> listener = rm.listener();
while (listener.hasNext()) {
MethodOrMethodContext next = listener.next();
seeds.addAll(computeSeeds(next.method()));
}
return seeds;
}
开发者ID:themaplelab,项目名称:ideal,代码行数:11,代码来源:Analysis.java
示例3: MatcherTransition
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
public MatcherTransition(State from, String methodMatcher, Parameter param, State to, Type type) {
super(from, to);
this.type = type;
this.param = param;
ReachableMethods methods = Scene.v().getReachableMethods();
QueueReader<MethodOrMethodContext> listener = methods.listener();
while (listener.hasNext()) {
MethodOrMethodContext next = listener.next();
SootMethod method = next.method();
if (Pattern.matches(methodMatcher, method.getSignature())) {
matchingMethods.add(method);
}
}
}
开发者ID:themaplelab,项目名称:ideal,代码行数:15,代码来源:MatcherTransition.java
示例4: 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);
}
}
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:13,代码来源:AnalyzeJimpleClassJIT.java
示例5: mayHappenInParallel
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
public boolean mayHappenInParallel(CriticalSection tn1, CriticalSection tn2)
{
if(mhp == null)
{
if(optionLeaveOriginalLocks)
return true;
ReachableMethods rm = Scene.v().getReachableMethods();
if(!rm.contains(tn1.method) || !rm.contains(tn2.method))
return false;
return true;
}
return mhp.mayHappenInParallel(tn1.method, tn2.method);
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:14,代码来源:CriticalSectionInterferenceGraph.java
示例6: onAnalysisFinished
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
@Override
public void onAnalysisFinished(PathEdge<Unit, WrappedAccessGraph> seed,
AnalysisSolver<TypestateDomainValue> solver) {
ReachableMethods rm = Scene.v().getReachableMethods();
QueueReader<MethodOrMethodContext> listener = rm.listener();
while (listener.hasNext()) {
MethodOrMethodContext next = listener.next();
SootMethod method = next.method();
if (!method.hasActiveBody())
continue;
Collection<Unit> endPointsOf = solver.icfg().getEndPointsOf(method);
for (Unit eP : endPointsOf) {
Set<WrappedAccessGraph> localsAtEndPoint = new HashSet<>();
for (Cell<WrappedAccessGraph, WrappedAccessGraph, EdgeFunction<TypestateDomainValue>> cell : solver
.getPathEdgesAt(eP)) {
if (!cell.getRowKey().equals(InternalAnalysisProblem.ZERO)) {
continue;
}
localsAtEndPoint.add(cell.getColumnKey());
}
boolean escapes = false;
for (WrappedAccessGraph ag : localsAtEndPoint) {
if (BoomerangContext.isParameterOrThisValue(method, ag.getBase())) {
escapes = true;
}
}
if (!escapes) {
Map<WrappedAccessGraph, TypestateDomainValue> resultAt = solver.resultsAt(eP);
for (Entry<WrappedAccessGraph, TypestateDomainValue> fact : resultAt.entrySet()) {
if (localsAtEndPoint.contains(fact.getKey())) {
if (!fact.getValue().equals(solver.bottom()))
endingPathsOfPropagation
.put(method, fact.getKey().getDelegate(), fact.getValue());
}
}
}
}
}
for (Cell<SootMethod, AccessGraph, TypestateDomainValue> res : endingPathsOfPropagation) {
if (res.getValue().endsInErrorState()) {
errorPathEdges.add(res);
}
}
}
开发者ID:themaplelab,项目名称:ideal,代码行数:49,代码来源:TypestateAnalysisProblem.java
示例7: setReachableMethods
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
public void setReachableMethods( ReachableMethods rm ) {
reachableMethods = rm;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:4,代码来源:Scene.java
示例8: 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;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:51,代码来源:LocalMustAliasAnalysis.java
示例9: getReachableMethodsFromThreads
import soot.jimple.toolkits.callgraph.ReachableMethods; //导入依赖的package包/类
protected void getReachableMethodsFromThreads(Set<ThreadProperties> startedRunnables)
{
if(this.callGraph == null)
{
this.callGraph = Scene.v().getCallGraph();
}
// Get reachable methods for all threads
for(ThreadProperties threadProperties : startedRunnables)
{
Type classType = threadProperties.getRunnableType();
SootClass runnableClass = Scene.v().loadClassAndSupport(classType.toString());
for(SootMethod sootMethod : runnableClass.getMethods())
{
// Only consider run() methods
if(!
(sootMethod.getDeclaration().equals("public void run()") ||
sootMethod.getDeclaration().equals("public static void main(java.lang.String[])")))
{
continue;
}
threadProperties.setRunMethod(sootMethod);
// Get directly reachable and transitive targets from this function
ReachableMethods directTargets = new ReachableMethods(this.callGraph, new Targets(callGraph.edgesOutOf(sootMethod)));
TransitiveTargets transitiveTargets = new TransitiveTargets(this.callGraph);
Iterator<MethodOrMethodContext> transitiveIterator = transitiveTargets.iterator(sootMethod);
while (transitiveIterator.hasNext())
{
SootMethod transitiveTarget = (SootMethod) transitiveIterator.next();
// Show all target methods not in JDK
if(!SusHelper.isPackageInJdk(SusHelper.getClassFromSignature(transitiveTarget.getSignature())))
{
// This method is directly reachable from this run()
if(directTargets.contains(transitiveTarget))
{
threadProperties.addDirectReachableMethod(transitiveTarget);
System.out.println(sootMethod + " may call " + transitiveTarget);
}
// This method is transitively reachable from this run()
else
{
threadProperties.addTransitiveReachableMethod(transitiveTarget);
System.out.println(sootMethod + " may reach " + transitiveTarget);
}
}
}
}
}
}
开发者ID:k4v,项目名称:Sus,代码行数:53,代码来源:CallGraphAnalysis.java
示例10: 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();
}
}
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:43,代码来源:PropagationSceneTransformerFilePrinter.java
注:本文中的soot.jimple.toolkits.callgraph.ReachableMethods类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论