[Soot-list] CallGraph question

Jia Chen jiaan27 at gmail.com
Thu Mar 24 19:04:04 EST 2005


Hi All,

I am working on a project that requires finding out all the methods
that are invoked as a result of one method being invoked. So I found a
piece of cod that builds a CallGraph from a method. However, when I
iterated through all out-going edges from the method, all I could see
were SPECIAL, STATIC, and FINALIZE edges. Can anyone tell me how I can
get the other edges also? Follows is the code I am using.

Thanks in advance.
Jia

// ---- Code using Soot ----------------------------------------------
Scene scene = Scene.v();
SootClass sootClass = scene.loadClassAndSupport(className);

Scene.v().setEntryPoints(sootClass.getMethods());
Map sparkOptions = new HashMap();
sparkOptions.put("enabled", "true");
sparkOptions.put("on-fly-cg", "true");
sparkOptions.put("set-impl", "hybrid");
sparkOptions.put("propagator", "worklist");
sparkOptions.put("verbose", "true");
SparkTransformer.v().transform("cg", sparkOptions);

SootMethod sMethod = sootClass.getMethod(methodName);
CallGraph callGraph = scene.getCallGraph();
Iterator iter = callGraph.edgesOutOf((MethodOrMethodContext)sMethod);

while (iter.hasNext()) {
	System.out.println(iter.next());
}
// ---- End of Code using Soot ----------------------------------------

// ---- Function being analyzed --------------------------
public void function5(int pram1, int pram2) {
	IfStatement ifStmt = new IfStatement();
	int i = 0, j = 0;

	String str = "testing";
	str.charAt(0);
	i = pram2;
	function6(i, j);
	b = function8(j, i);
}
// ---- End of function being analyzed --------------------

// ---- Output ----------------------------------------------
SPECIAL edge: specialinvoke $r2.<tempclass.IfStatement: void
<init>()>() in <.tempclass.IfStatement: void function5(int,int)> ==>
<tempclass.IfStatement: void <init>()>
// ---- End of Output ----------------------------------------


More information about the Soot-list mailing list