Configuring Soot to run your analysis can be a tough job. We have a fluent interface that can help you.
Soot is a swiss-army knife of a program analysis framework. Its command-line based configuration interface features multiple pages of configuration options that build on each other, depend on each other and also may contradict each other. We developed a fluent interface to counter this problem.
Git RepositoryWe maintain the source code of the analysis as a GitHub project. You are invited to use it, build opon it, fork it or contribute to it via pull requests. However, we cannot provide any guarantee whatsoever.
Instead of supplying Soot with an array of strings containing the configuration options like this:
-keep-line-number -full-resolver -no-bodies-for-excluded -allow-phantom-refs -w -f n -pp -p cg -p jb use-original-names:true -p cg all-reachable:true -p tag.ln enabled:true
You may now use the FluentOptions
class to construct an object like this:
public final static FluentOptions standard = new FluentOptions() .keepLineNumbers() .fullResolver() .noBodiesForExcluded() .allowPhantomReferences() .wholeProgramAnalysis() .outputFormat("none") .prependClasspath() .addPhaseOptions(new CallGraphPhaseOptions().processAllReachable()) .addPhaseOptions( new JimpleBodyCreationPhaseOptions().useOriginalNames()) .addPhaseOptions(new TagAggregatorOptions().aggregateLineNumber());
Through the AnalysisTarget
class you can now target your analysis to a single jar file, a code path, or a class file. If you combine the target and the configuration in a SootRun
object and call the perform()
-method Soot will run according to your configuration.
AnalysisTarget t = new AnalysisTarget().processPath( pathToJar.toString()).classPathToProcessPathDirectory(); SootRun analysisRun = new SootRun(o, t); analysisRun.perform();