当前位置: 首页>>代码示例>>Java>>正文


Java CallGraph类代码示例

本文整理汇总了Java中soot.jimple.toolkits.callgraph.CallGraph的典型用法代码示例。如果您正苦于以下问题:Java CallGraph类的具体用法?Java CallGraph怎么用?Java CallGraph使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CallGraph类属于soot.jimple.toolkits.callgraph包,在下文中一共展示了CallGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: myDebug

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
private static void myDebug(String message) {
    logger.info("start debug... " + message);
    {
        CallGraph cg = Scene.v().getCallGraph();
        Iterator<Edge> edges = cg
                .edgesOutOf(Scene
                        .v()
                        .getMethod(
                                "<android.accounts.IAccountAuthenticatorResponse$Stub$Proxy: void onError(int,java.lang.String)>"));
        while (edges.hasNext()) {
            Edge e = edges.next();
            logger.info("edge: " + e);
        }
    }
    logger.info("end debug... " + message);
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:17,代码来源:CHAFindPermissionChecks.java

示例2: initIFDS

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
private void initIFDS() {
	Scene.v().setCallGraph(new CallGraph());
	this.jumpFunctions = new JumpFunctions<Unit, FlowAbstraction, IFDSSolver.BinaryDomain>(IFDSSolver.getAllTop());
	this.endSum = HashBasedTable.create();
	this.inc = HashBasedTable.create();
	this.icfg = new JitIcfg(new ArrayList<SootMethod>()) {
		@Override
		public Set<SootMethod> getCalleesOfCallAt(Unit u) {
			if (currentTask != null)
				return currentTask.calleesOfCallAt(u);
			else // Empty by default (same behaviour as L1)
				return new HashSet<SootMethod>();
		}
	};
	this.reporter.setIFDS(icfg, jumpFunctions);
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:17,代码来源:LayeredAnalysis.java

示例3: searchPermissions

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public static void searchPermissions(CallGraph cg, Map<SootMethod, Set<String>> methodToPermissionSet) {
    ForwardSearch.methodToPermissionSet = methodToPermissionSet;
//    Set<SootMethod> checkGEOnePermn = new HashSet<SootMethod>(); // methods which check at least one permission
//    for (SootMethod sm: methodToPermissionSet.keySet()) {
//      if (methodToPermissionSet.get(sm).size() == 0)
//        continue;
//      checkGEOnePermn.add(sm);
//      alreadyComputed.add(sm);
//      System.out.println("already computed: "+ sm);
//    }
    SootMethod main = Scene.v().getMainMethod();
    Stack<SootMethod> stack = new Stack<SootMethod>();
    stack.push(main);
    search(cg, main, stack, 0);
    computeEntryPointPermissions();
    
  }
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:18,代码来源:ForwardSearch.java

示例4: getDependencies

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public static Set<Class> getDependencies(Scene scene, CallGraph callGraph, Class<?> clazz) {
    Set<Class> dependencies = Sets.newHashSet();

    SootClass sootClass = scene.getSootClass(clazz.getName());

    for(SootMethod method: sootClass.getMethods())
        if(!method.isPhantom())
            callGraph.edgesInto(method).forEachRemaining(edge -> {
                try {
                    dependencies.add(Class.forName(edge.getSrc().method().getDeclaringClass().getName()));
                } catch (ClassNotFoundException e) {
                    log.info(String.format("Class not found: %s", edge.getSrc().method().getDeclaringClass().getName()));
                }
            });

    return dependencies;
}
 
开发者ID:uwdb,项目名称:pipegen,代码行数:18,代码来源:SootUtilities.java

示例5: findTargetMethods

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
private List<SootMethod> findTargetMethods(Unit unit, CallGraph cg, boolean canBeNullList, boolean canBeNative){
	List<SootMethod> target = new ArrayList<SootMethod>(); 
	Iterator<Edge> it = cg.edgesOutOf(unit);
	while (it.hasNext()){
		Edge edge = it.next();
		SootMethod targetMethod = edge.tgt();
		if (targetMethod.isNative() && !canBeNative )
			continue;
		if (edge.kind() == Kind.CLINIT )
			continue;
		target.add(targetMethod);
	}
	if (target.size() < 1 && !canBeNullList){
		throw new RuntimeException("No target method for: "+unit);
	}
	return target;
}
 
开发者ID:parasol-aser,项目名称:tsa,代码行数:18,代码来源:MultiRunStatementsFinderX.java

示例6: RecAnalysis

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
/**
 * Do a recursion analysis. We even look at recursive thread generations.
 * @param cba The callback resolver for thread calls.
 * @param cg The callgraph. 
 */
RecAnalysis(CallbackResolver cba, CallGraph cg) {
	int size = 0;
	Scene scene = Scene.v();
	allMethods = new HashSet <SootMethod>();
	
	for (SootClass cl : (Collection <SootClass>) scene.getClasses()) {
		for (SootMethod m : (Collection <SootMethod>) cl.getMethods()) {
				size++;
				allMethods.add(m);
		}
	}
	graph = new CGraph(size,cg,cba);
	tarjAnalysis = new Tarjan <SootMethod>(graph);
	
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:21,代码来源:RecAnalysis.java

示例7: executeTarjan

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public List<List<SootMethod>> executeTarjan(CallGraph graph){
  scc.clear();
  index = 0;
  stack.clear();
  SootMethod mainMethod = Scene.v().getMethod("<MainClass: void main(java.lang.String[])>");
  tarjan(mainMethod, graph);
  return scc;
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:9,代码来源:Tarjan.java

示例8: main

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public static void main(String[] args) {
   List<String> argsList = new ArrayList<String>(Arrays.asList(args));
   argsList.addAll(Arrays.asList(new String[]{
		   "-w",
		   "-main-class",
		   "testers.CallGraphs",//main-class
		   "testers.CallGraphs",//argument classes
		   "testers.A"			//
   }));


   PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTrans", new SceneTransformer() {

	@Override
	protected void internalTransform(String phaseName, Map options) {
	       CHATransformer.v().transform();
                      SootClass a = Scene.v().getSootClass("testers.A");

	       SootMethod src = Scene.v().getMainClass().getMethodByName("doStuff");
	       CallGraph cg = Scene.v().getCallGraph();

	       Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(src));
	       while (targets.hasNext()) {
	           SootMethod tgt = (SootMethod)targets.next();
	           System.out.println(src + " may call " + tgt);
	       }
	}
	   
   }));

          args = argsList.toArray(new String[0]);
          
          soot.Main.main(args);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:35,代码来源:CallGraphExample.java

示例9: getCallGraph

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public CallGraph getCallGraph() 
{
    if(!hasCallGraph()) {
        throw new RuntimeException( "No call graph present in Scene. Maybe you want Whole Program mode (-w)." );
    }
        
    return activeCallGraph;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:9,代码来源:Scene.java

示例10: countCallEdgesForCallsite

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public static int countCallEdgesForCallsite(Stmt callsite, boolean stopForMutiple)
{
	CallGraph cg = Scene.v().getCallGraph();
	int count = 0;
	
	for ( Iterator<Edge> it = cg.edgesOutOf(callsite); 
			it.hasNext(); ) {
		it.next();
		++count;
		if ( stopForMutiple && count > 1) break;
	}
	
	return count;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:15,代码来源:SootInfo.java

示例11: getInvokeInfoFlowSummary

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
protected HashMutableDirectedGraph<EquivalentValue> getInvokeInfoFlowSummary(
			InvokeExpr ie, Stmt is, SootMethod context)
	{
		// get the data flow graph for each possible target of ie,
		// then combine them conservatively and return the result.
		HashMutableDirectedGraph<EquivalentValue> ret = null;
		
		SootMethodRef methodRef = ie.getMethodRef();
		String subSig = methodRef.resolve().getSubSignature();
		CallGraph cg = Scene.v().getCallGraph();
		for(Iterator<Edge> edges = cg.edgesOutOf(is); edges.hasNext();)
		{
			Edge e = edges.next();
			SootMethod target = e.getTgt().method();
			// Verify that this target is an implementation of the method we intend to call,
			// and not just a class initializer or other unintended control flow.
			if(target.getSubSignature().equals(subSig))
			{
				HashMutableDirectedGraph<EquivalentValue> ifs = getMethodInfoFlowSummary(
						target, context.getDeclaringClass().isApplicationClass());
				if(ret == null)
					ret = ifs;
				else
				{
					for(EquivalentValue node : ifs.getNodes())
					{
						if(!ret.containsNode(node))
							ret.addNode(node);
						for(EquivalentValue succ : ifs.getSuccsOf(node))
							ret.addEdge(node, succ);
					}
				}
			}
			
		}
		return ret;
//		return getMethodInfoFlowSummary(methodRef.resolve(), context.getDeclaringClass().isApplicationClass());
	}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:39,代码来源:InfoFlowAnalysis.java

示例12: MultiRunStatementsFinder

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public MultiRunStatementsFinder(UnitGraph g, SootMethod sm, Set<SootMethod> multiCalledMethods, CallGraph cg)
{
	super(g);
	
	nodeToIndex = new HashMap<Object, Integer>();
			
	//      System.out.println("===entering MultiObjectAllocSites==");	
	doAnalysis();
	
	//testMultiObjSites(sm);
	findMultiCalledMethodsIntra(multiCalledMethods, cg);
	
	// testMultiObjSites(sm);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:15,代码来源:MultiRunStatementsFinder.java

示例13: byMCalledS0

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
private void byMCalledS0(PegCallGraph pcg) {
	Iterator it = pcg.iterator();
	while (it.hasNext()){
		SootMethod sm = (SootMethod)it.next();
		UnitGraph graph = new CompleteUnitGraph(sm.getActiveBody());
		CallGraph callGraph = Scene.v().getCallGraph();
		MultiRunStatementsFinder finder = new MultiRunStatementsFinder(graph, sm, multiCalledMethods, callGraph);
		FlowSet fs = finder.getMultiRunStatements();
	}
	
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:12,代码来源:MultiCalledMethods.java

示例14: getTransientDependencies

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
public static Set<Class> getTransientDependencies(Scene scene, CallGraph callGraph, Class<?> clazz) {
    Queue<Class> pendingClasses = ArrayUtilities.newArrayDeque(clazz);
    Set<Class> classes = Sets.newHashSet();

    while(!pendingClasses.isEmpty()) {
        Set<Class> newClasses = getDependencies(scene, callGraph, pendingClasses.poll())
                                    .stream()
                                    .filter(c -> !classes.contains(c))
                                    .collect(Collectors.toSet());
        classes.addAll(newClasses);
        pendingClasses.addAll(newClasses);
    }

    return classes;
}
 
开发者ID:uwdb,项目名称:pipegen,代码行数:16,代码来源:SootUtilities.java

示例15: handleInvokeExpr

import soot.jimple.toolkits.callgraph.CallGraph; //导入依赖的package包/类
private void handleInvokeExpr(InvokeExpr ie, Stmt is)
  {
//	  if(is.toString().contains("hashCode"))
//		  System.out.println();
	  

		CallGraph cg = Scene.v().getCallGraph();
		for(Iterator<Edge> edges = cg.edgesOutOf(is); edges.hasNext();)
		{
			Edge e = edges.next();
			SootMethod target = e.getTgt().method();
			//if(method.getDeclaringClass().isApplicationClass())
		      if(!Util.skipPackage(target.getDeclaringClass().getPackageName()))
		      {	  
		    	  //SootMethodRef methodRef = ie.getMethodRef();
				//String subSig = methodRef.resolve().getSubSignature();//MAY NOT BE SOUND
					// Verify that this target is an implementation of the method we intend to call,
					// and not just a class initializer or other unintended control flow.
					//if(target.getSubSignature().equals(subSig))
					{
						analyze(target);
					}
		      }


		}
  }
 
开发者ID:parasol-aser,项目名称:tsa,代码行数:28,代码来源:ThreadSharingAnalyzer.java


注:本文中的soot.jimple.toolkits.callgraph.CallGraph类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。