[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SPARK option set
Traditionally, Soot phase options have been stored in HashMaps, and each
phase had to pull out what it needed out of the HashMap, and parse it
itself. The SparkOptions class (as well as other similar classes
auto-generated from soot_options.xml) is a read-only accessor that does
this parsing of the HashMap for you.
The method set_impl() is *NOT* a setter method. It is a method that
parses out the set-impl option. For each phase option, there is a method
with the same name (but with - replaced by _) to parse out that option.
The actual options themselves are still stored in the HashMap. This
HashMap is usually created by the PhaseOptions class, which finds the
default options for the phase, and keeps track of any other options that
have been set (typically from the command line), and builds this HashMap
for you.
The PhaseOptions class works on Transformers wrapped in Transform
classes, which just give the Transformer a name. Since you've decided
not to write a Transformer, you can just create a Transform with a null
Transformer; you should give it the name "cg.spark" if you want it to
have the default options from the regular "cg.spark" phase.
So, your code might look something like this:
Transform sparkTranform = new Transform( "cg.spark", null );
PhaseOptions.v().setPhaseOption( sparkTranform, "verbose:true" );
Map options = PhaseOptions.v().getPhaseOptions( sparkTranform );
PointsToAnalysis spark = new PAG( new SparkOptions( options );
The second line is just an example of how to set the value of an option;
you can replace it with whatever settings you need.
You ask whether there is a paper describing the options in more
detail. All the phase options, including Spark, are documented in the
phase options tutorial, found in the tutorial directory in the Soot
distribution, as well as on-line. If you need more detail on how Spark
works, it's all in my M.Sc. thesis.
Ondrej
On Sun, Aug 03, 2003 at 12:43:03AM +0100, Eric Bodden wrote:
> Hi!
>
> I am currently about to use SPARK using the API and not soot.Main etc. So I
> came across the class SparkOptions and I don't really understand how it
> works. My current code is:
> --
> List paths = new LinkedList();
> paths.add(projectPath);
> Options.v().set_process_dir(paths);
> Options.v().set_soot_classpath(getSootClasspath().getSootClasspath()+getSoot
> Classpath().getSeparator()+getProcess_path());
> Scene.v().loadNecessaryClasses();
> PointsToAnalysis spark = new PAG(new SparkOptions(new HashMap()));
> CallGraphBuilder builder = new CallGraphBuilder(spark);
> builder.build();
> CallGraph graph = builder.getCallGraph();
> System.out.println(graph);
> --
> But I always get the message:
> --
> Invalid value of phase option set-impl
> --
> So how in general can I feed options into a SparkOptions set? For example
> "public int set_impl()" does not take a parameter at all. It even returns
> one!? I just don't understand the system in general I think. Also: Is there
> a paper or something which describes the options in more detail?
>
> Cheers,
> Eric
>
>