本文整理汇总了Java中soot.jimple.toolkits.callgraph.CallGraph.edgesOutOf方法的典型用法代码示例。如果您正苦于以下问题:Java CallGraph.edgesOutOf方法的具体用法?Java CallGraph.edgesOutOf怎么用?Java CallGraph.edgesOutOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.jimple.toolkits.callgraph.CallGraph
的用法示例。
在下文中一共展示了CallGraph.edgesOutOf方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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());
}
示例5: 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);
}
}
}
}
示例6: search
import soot.jimple.toolkits.callgraph.CallGraph; //导入方法依赖的package包/类
private static void search(CallGraph cg, SootMethod l, Stack<SootMethod> stack, int depth) {
logger.debug(" <"+ depth +"> propagate from "+ l);
if (depth == 1)
currentWrapper = l;
if (depth == 2) {
currentEntryPoint = l;
if (currentEntryPoint.toString().contains("GenerationGG") ||
//currentEntryPoint.toString().contains("init>") ||
currentEntryPoint.toString().contains("ServicesInit:")) {
} else {
if (!currentEntryPoint.toString().contains("DumbClass:")) {
EntryPointKey epk = new EntryPointKey(currentWrapper, currentEntryPoint);
entryPointsToPermissionSet.put(epk, null);
}
}
}
if (alreadyComputed.contains(l)) {
addPermissionsToStack(stack, l);
return;
}
Iterator<Edge> it = cg.edgesOutOf(l);
while (it.hasNext()) {
Edge e = it.next();
SootMethod outMethod = e.tgt();
if (outMethod.toString().equals(l.toString())){
logger.warn("outMethod same as l: "+ l);
continue;
}
if (stack.contains(outMethod))
throw new RuntimeException("cycle in stack!\n" + outMethod +"\n"+ Util.printStack(stack));
addPermissionsToStack(stack, outMethod);
stack.push(outMethod);
search(cg, outMethod, stack, depth+1);
stack.pop();
}
alreadyComputed.add(l);
if (!methodToPermissionSet.containsKey(l))
methodToPermissionSet.put(l, new HashSet<String>());
}
示例7: checkCallGraph
import soot.jimple.toolkits.callgraph.CallGraph; //导入方法依赖的package包/类
/**
* Report the virtual callsites resolution result for the user's code.
*/
public void checkCallGraph()
{
int[] limits = new int[] { 1, 2, 4, 8 };
evalRes.total_call_edges = new Histogram(limits);
CallGraph cg = Scene.v().getCallGraph();
for ( Stmt callsite : ptsProvider.multiCallsites ) {
Iterator<Edge> edges = cg.edgesOutOf(callsite);
if ( !edges.hasNext() ) continue;
evalRes.n_callsites++;
// get an edge
Edge anyEdge = edges.next();
SootMethod src = anyEdge.src();
if ( !ptsProvider.isReachableMethod(src) ||
!ptsProvider.isValidMethod(src) )
continue;
// get the base pointer
CgEdge p = ptsProvider.getInternalEdgeFromSootEdge(anyEdge);
LocalVarNode vn = (LocalVarNode)p.base_var;
// test the call graph
int edge_cnt = 1;
while ( edges.hasNext() ) {
++edge_cnt;
edges.next();
}
evalRes.n_geom_call_edges += edge_cnt;
if ( edge_cnt == 1 ) ++evalRes.n_geom_solved_all;
// test app method
if ( !src.isJavaLibraryMethod() ) {
InvokeExpr ie = callsite.getInvokeExpr();
if ( edge_cnt == 1 ) {
++evalRes.n_geom_solved_app;
if ( ptsProvider.getOpts().verbose() ) {
outputer.println();
outputer.println("<<<<<<<<< Additional Solved Call >>>>>>>>>>");
outputer.println(src.toString());
outputer.println(ie.toString());
}
} else {
// We try to test if this callsite is solvable
// under some contexts
Histogram call_edges = new Histogram(limits);
test_1cfa_call_graph(vn, src, ie.getMethod(), call_edges);
evalRes.total_call_edges.merge(call_edges);
call_edges = null;
}
evalRes.n_geom_user_edges += edge_cnt;
evalRes.n_user_callsites++;
}
}
ptsProvider.ps.println();
ptsProvider.ps.println("--------> Virtual Callsites Evaluation <---------");
ptsProvider.ps.printf("Total virtual callsites (app code): %d (%d)\n",
evalRes.n_callsites, evalRes.n_user_callsites);
ptsProvider.ps.printf("Total virtual call edges (app code): %d (%d)\n",
evalRes.n_geom_call_edges, evalRes.n_geom_user_edges);
ptsProvider.ps.printf("Virtual callsites additionally solved by geomPTA compared to SPARK (app code) = %d (%d)\n",
evalRes.n_geom_solved_all, evalRes.n_geom_solved_app);
evalRes.total_call_edges.printResult(ptsProvider.ps,
"Testing of unsolved callsites on 1-CFA call graph: ");
if (ptsProvider.getOpts().verbose())
ptsProvider.outputNotEvaluatedMethods();
}