use of soot.jimple.toolkits.callgraph.CallGraph in project soot by Sable.
the class TypeBasedReflectionModelTest method genericLocalVsStringConstantTest.
private void genericLocalVsStringConstantTest(boolean useConstantBase) {
resetSoot();
Options.v().set_allow_phantom_refs(true);
Options.v().set_whole_program(true);
Options.v().set_no_bodies_for_excluded(true);
Scene.v().loadBasicClasses();
SootClass tc = setUpTestClass(useConstantBase);
Scene.v().addClass(tc);
tc.setApplicationClass();
Scene.v().setMainClass(tc);
Scene.v().forceResolve(tc.getName(), BODIES);
Scene.v().loadNecessaryClasses();
Options.v().setPhaseOption("cg.spark", "on");
Options.v().setPhaseOption("cg", "types-for-invoke:true");
// this option is necessary to get constant bases working
Options.v().setPhaseOption("wjpp.cimbt", "enabled:true");
Options.v().setPhaseOption("wjpp.cimbt", "verbose:true");
PackManager.v().getPack("wjpp").apply();
PackManager.v().getPack("cg").apply();
CallGraph callGraph = Scene.v().getCallGraph();
boolean found = false;
for (Edge edge : callGraph) {
if (edge.getSrc().method().getSignature().contains("main") && edge.getTgt().method().getSignature().contains("concat")) {
found = true;
break;
}
}
Assert.assertTrue("There should be an edge from main to String.concat after resolution of the target of Method.invoke, but none found", found);
}
Aggregations