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


Java Edge类代码示例

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


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

示例1: myDebug

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的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: visit

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
private void visit(Set<SootMethod> alreadyVisited, SootMethod current, int depth) {
  if (depth >= ConfigCHA.v().getGraphOutMaxDepth())
    return;
  Iterator<Edge> it = cg.edgesOutOf(current);
  while (it.hasNext()) {
    Edge e = it.next();
    SootMethod tgt = e.tgt();
    for (int i=0; i < ConfigCHA.v().getGraphOutMaxDepth(); i++) {
      if (depth <= i)
        out.get(i).println(current+";"+tgt);
    }
    if (alreadyVisited.contains(tgt))
      continue;
    alreadyVisited.add(tgt);
    visit(alreadyVisited, tgt, depth+1);
  }
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:18,代码来源:OutputGraph.java

示例3: load

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
@Override
public Collection<SootMethod> load(Unit u) throws Exception {
	ArrayList<SootMethod> res = null;
	//only retain callers that are explicit call sites or Thread.start()
	Iterator<Edge> edgeIter = new EdgeFilter().wrap(cg.edgesOutOf(u));					
	while(edgeIter.hasNext()) {
		Edge edge = edgeIter.next();
		SootMethod m = edge.getTgt().method();
		if(m.hasActiveBody()) {
			if (res == null)
				res = new ArrayList<SootMethod>();
			res.add(m);
		}
		else if(IDESolver.DEBUG) 
			System.err.println("Method "+m.getSignature()+" is referenced but has no body!");
	}
	
	if (res != null) {
		res.trimToSize();
		return res;
	}
	else
		return Collections.emptySet();
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:25,代码来源:JimpleBasedInterproceduralCFG.java

示例4: findTargetMethods

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的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

示例5: neighbours

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
@Override
public Collection <SootMethod> neighbours(SootMethod obj) {
	SootMethod m = (SootMethod) obj;
	Set <SootMethod> result = new HashSet <SootMethod>();
	for (Iterator <Edge> it = cg.edgesOutOf(m); it.hasNext(); ) {
		Edge e = it.next();
		// Do not consider spurious loops enabled by clinit.
		if (e.isClinit()) continue;
		if ((e.tgt().getName().equals("<init>")) && cba.isActive(e)) {
			Map<SootMethod, String> ir = cba.resolve(e);
			if (ir != null) {
				result.addAll(ir.keySet());
			}
		}
		else result.add(e.getTgt().method());
	}

	return result;
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:20,代码来源:RecAnalysis.java

示例6: resolveLinkThrough

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
/** 
 * Auxiliary methods that taken a pointstoset representing a set
    * of objects origins and a method identifying as establishing a
    * link between origin objects and destination objects, gives
    * back an over-approximation of the set of destination methods
    * potentially linked to those origins objects 
 * @param orig the set of origins abstracted as a pointstoset
 * @param lm the link method represented by the name of the
 * 	method and the position of the origin and destination
 * 	parameters in a call.
 * @return the destination objects abstracted as a pointstoset
 */

private PointsToSet resolveLinkThrough (PointsToSet orig, LinkMethod lm) {
	Iterator <Edge> ite = callgraph.edgesInto(lm.method);
	Union result = new MemoryEfficientRasUnion();
	while(ite.hasNext()) {
		Edge inedge =  ite.next();
		InvokeExpr ie = inedge.srcStmt().getInvokeExpr();
		if (ie != null) {
			PointsToSet ptFrom = getPointsTo(ie,lm.fromIndex);
			if(Union.hasNonEmptyIntersection(orig, ptFrom)) {
				PointsToSet ptTo = getPointsTo(ie,lm.toIndex);
				result.addAll(ptTo);
			}
		}
	}
	return result;
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:30,代码来源:CallbackResolver.java

示例7: abortedBroadcastsTypes

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
/**
 * Gives the type of all the broadcast receiver that may be aborted. It looks at all the calls to abortBroadcast and through the Points-to analysis at the
 * actual class of the base arguments of the calls.
 * @return a set of soot type that may be empty.
 */
private Set<String> abortedBroadcastsTypes() {
    Set <String> result = new HashSet<String>();
    try {
        SootClass receiverClass = scene.getSootClass(ANDROID_CONTENT_BROADCASTRECEIVER);
        SootMethod abortMethod = receiverClass.getMethod(BROADCAST_ABORT_SIGNATURE);
        Iterator<Edge> edges = cg.edgesInto(abortMethod);
        while(edges.hasNext()) {
            Edge edge = edges.next();
            InvokeExpr ie = edge.srcStmt().getInvokeExpr();
            if (ie == null || ! (ie instanceof InstanceInvokeExpr)) continue;
            Value base = ((InstanceInvokeExpr) ie).getBase();
            if (!(base instanceof Local)) continue;
            PointsToSet basePTS = pag.reachingObjects((Local) base);
            addAll(result,basePTS.possibleTypes());
        }
    } catch (RuntimeException e) {
        Out.getLog().println("Error while computing aborted broadcast " + e.getMessage());         
    }
    return result;
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:26,代码来源:AbortedBroadcastReceiver.java

示例8: checkForPermission

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
public static boolean checkForPermission (Edge e, Set<String> mpSet, Stack<SootMethod> stack) {
  
  SootMethod src = e.getSrc().method(); // is in the stack
  SootMethod tgt = e.getTgt().method(); // is not in the stack

  String tgtS = tgt.getName();

  if (!isCheckPermissionMethod(tgt))
    return false;
  
  AnalysisType.v().start();
  
  logger.info("check for permission: "+ e);

  // At this point we are sure that the target of the edge is a method
  // which checks Android permissions

  getStringFromMethod (stack, stack.size()-1, tgt, 0, mpSet);
  
  int mpSetSize = mpSet.size();
  AnalysisType.v().cur().setNbrPermissions(mpSetSize); 
  if (mpSetSize == 0) {
    logger.warn("WWWWWWWWW we could not find a perm string in "+ src);
    logger.warn(Util.printStack(stack));
    // we add the UNKNOWN permisson
    mpSet.add(UNKNOWN_PERM);
  }
  
  AnalysisType.v().end();
  return true;
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:32,代码来源:CheckForPermission.java

示例9: isInheritedMethod

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
private boolean isInheritedMethod(Stmt stmt, String... classNames) {
	Iterator<Edge> edgeIt = Scene.v().getCallGraph().edgesOutOf(stmt);
	while (edgeIt.hasNext()) {
		Edge edge = edgeIt.next();
		String targetClass = edge.getTgt().method().getDeclaringClass().getName();
		for (String className : classNames)
			if (className.equals(targetClass))
				return true;
	}
	return false;
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:12,代码来源:AnalyzeJimpleClassJIT.java

示例10: addInterproceduralAssignment

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
public Pair<Node, Node> addInterproceduralAssignment(Node from, Node to, Edge e) 
{
	Pair<Node, Node> val = new Pair<Node, Node>(from, to);
	
	if ( runGeomPTA ) {
		Set<Edge> sets = assign2edges.get(val);
		if ( sets == null ) {
			sets = new HashSet<Edge>();
			assign2edges.put(val, sets);
		}
		sets.add(e);
	}
	
	return val;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:16,代码来源:PAG.java

示例11: countCallEdgesForCallsite

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的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

示例12: contextsByAnyCallEdge

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
/**
 * Searching the points-to results for field expression such as p.f.
 * 
 * @param sootEdge
 * @param l
 * @param field
 * @param visitor
 * @return
 */
@SuppressWarnings("rawtypes")
public boolean contextsByAnyCallEdge(Edge sootEdge, Local l, SparkField field, PtSensVisitor visitor)
{
	Obj_full_extractor pts_l = new Obj_full_extractor();
	if ( contexsByAnyCallEdge(sootEdge, l, pts_l) == false )
		return false;
	
	visitor.prepare();
	for ( IntervalContextVar icv : pts_l.outList ) {
		AllocNode obj = (AllocNode)icv.var;
		AllocDotField obj_f = geomPts.findAllocDotField(obj, field);
		if ( obj_f == null ) continue;
		IVarAbstraction objField = geomPts.findInternalNode(obj_f);
		if ( objField == null ) continue;
		
		long L = icv.L;
		long R = icv.R;
		assert L < R;
		objField.get_all_context_sensitive_objects(L, R, visitor);
	}
	
	pts_l = null;
	
	visitor.finish();
	return visitor.numOfDiffObjects() != 0;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:36,代码来源:GeomQueries.java

示例13: contextByCallChain

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
/**
 * Standard K-CFA querying for field expression.
 * 
 * @param callEdgeChain: callEdgeChain[0] is the farthest call edge in the chain.
 * @param l
 * @param field
 * @param visitor
 * @return
 */
@SuppressWarnings("rawtypes")
public boolean contextByCallChain(Edge[] callEdgeChain, Local l, SparkField field, PtSensVisitor visitor)
{
	// We first obtain the points-to information for l
	Obj_full_extractor pts_l = new Obj_full_extractor();
	if ( contextsByCallChain(callEdgeChain, l, pts_l) == false )
		return false;
	
	// We compute the points-to information for l.field
	visitor.prepare();
	
	for ( IntervalContextVar icv : pts_l.outList ) {
		AllocNode obj = (AllocNode)icv.var;
		AllocDotField obj_f = geomPts.findAllocDotField(obj, field);
		if ( obj_f == null ) continue;
		IVarAbstraction objField = geomPts.findInternalNode(obj_f);
		if ( objField == null ) continue;
		
		long L = icv.L;
		long R = icv.R;
		assert L < R;
		objField.get_all_context_sensitive_objects(L, R, visitor);
	}
	
	pts_l = null;
	
	visitor.finish();
	return visitor.numOfDiffObjects() != 0;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:39,代码来源:GeomQueries.java

示例14: prepareContainers

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的package包/类
/**
	 * Data structures that only specific to geometric solver are created here.
	 * The initialized container sizes are empirically chosen from the primes.
	 * We believe most of the machine today can afford the memory overhead.
	 */
	private void prepareContainers()
	{
		// All kinds of variables
		consG = new HashMap<Node, IVarAbstraction>(39341);
		
		// Only the pointer variables
		pointers = new ZArrayNumberer<IVarAbstraction>(25771);
		
		// Only the heap variables
		allocations = new ZArrayNumberer<IVarAbstraction>();
		
		// The constraints extracted from code
		constraints = new ZArrayNumberer<PlainConstraint>(25771);
		
		// The statements that fork a new thread
		thread_run_callsites = new HashSet<Stmt>(251);
		
		// The virtual callsites that have multiple call targets
		multiCallsites = new HashSet<Stmt>(251);
		
		// The fake virtual call edges created by SPARK
//		obsoletedEdges = new Vector<CgEdge>(4021);
		
		// A linkedlist used for traversing the call graph
		queue_cg = new LinkedList<Integer>();
		
		// Containers for functions and call graph edges
		func2int = new HashMap<SootMethod, Integer>(5011);
		int2func = new HashMap<Integer, SootMethod>(5011);
		edgeMapping = new HashMap<Edge, CgEdge>(19763);
		
		consG.clear();
		constraints.clear();
		func2int.clear();
		edgeMapping.clear();
	}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:42,代码来源:GeomPointsTo.java

示例15: getInvokeInfoFlowSummary

import soot.jimple.toolkits.callgraph.Edge; //导入依赖的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


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