use of dk.brics.soot.analyses.SimpleVeryBusyExpressions in project soot by Sable.
the class RunVeryBusyAnalysis method main.
public static void main(String[] args) {
args = new String[] { "testers.VeryBusyClass" };
if (args.length == 0) {
System.out.println("Usage: java RunVeryBusyAnalysis class_to_analyse");
System.exit(0);
}
String sep = File.separator;
String pathSep = File.pathSeparator;
String path = System.getProperty("java.home") + sep + "lib" + sep + "rt.jar";
path += pathSep + "." + sep + "tutorial" + sep + "guide" + sep + "examples" + sep + "analysis_framework" + sep + "src";
Options.v().set_soot_classpath(path);
SootClass sClass = Scene.v().loadClassAndSupport(args[0]);
sClass.setApplicationClass();
Scene.v().loadNecessaryClasses();
for (SootMethod m : sClass.getMethods()) {
Body b = m.retrieveActiveBody();
System.out.println("=======================================");
System.out.println(m.toString());
UnitGraph graph = new ExceptionalUnitGraph(b);
VeryBusyExpressions vbe = new SimpleVeryBusyExpressions(graph);
for (Unit u : graph) {
List<AbstractBinopExpr> before = vbe.getBusyExpressionsBefore(u);
List<AbstractBinopExpr> after = vbe.getBusyExpressionsAfter(u);
UnitPrinter up = new NormalUnitPrinter(b);
up.setIndent("");
System.out.println("---------------------------------------");
u.toString(up);
System.out.println(up.output());
System.out.print("Busy in: {");
sep = "";
for (AbstractBinopExpr e : before) {
System.out.print(sep);
System.out.print(e.toString());
sep = ", ";
}
System.out.println("}");
System.out.print("Busy out: {");
sep = "";
for (AbstractBinopExpr e : after) {
System.out.print(sep);
System.out.print(e.toString());
sep = ", ";
}
System.out.println("}");
System.out.println("---------------------------------------");
}
System.out.println("=======================================");
}
}
Aggregations