constructCallgraph()函数用来得到调用函数关系图
默认的是AutomaticSelection方法,可能会忽略一些函数关系
画图的参数源代码:
protected void configureCallgraph() {
switch(this.config.getCallgraphAlgorithm()) {
case AutomaticSelection:
case SPARK:
Options.v().setPhaseOption("cg.spark", "on");
break;
case GEOM:
Options.v().setPhaseOption("cg.spark", "on");
AbstractInfoflow.setGeomPtaSpecificOptions();
break;
case CHA:
Options.v().setPhaseOption("cg.cha", "on");
break;
case RTA:
Options.v().setPhaseOption("cg.spark", "on");
Options.v().setPhaseOption("cg.spark", "rta:true");
Options.v().setPhaseOption("cg.spark", "on-fly-cg:false");
break;
case VTA:
Options.v().setPhaseOption("cg.spark", "on");
Options.v().setPhaseOption("cg.spark", "vta:true");
break;
default:
throw new RuntimeException("Invalid callgraph algorithm");
}
if (this.config.getEnableReflection()) {
Options.v().setPhaseOption("cg", "types-for-invoke:true");
}
}
在调用constructCallgraph之前修改参数
SetupApplication app = new SetupApplication(platformDir, apkDir);
app.getConfig().setCallgraphAlgorithm(InfoflowConfiguration.CallgraphAlgorithm.GEOM);
app.constructCallgraph();