[Soot-list] accessing basic blocks

John Jorgensen jorgnsn at lcd.uregina.ca
Wed Apr 19 21:29:56 EDT 2006


"Richard L. Halpert" wrote (in reply to Kevin Dean) wrote:

    richhal22> I think what you're looking BodyTransformer (you
    richhal22> do intend to add/remove/tag/annotate statements,
    richhal22> right?).  You should extend the BodyTransformer
    richhal22> class, and override the internalTransform method.

You can find a fairly short example of this technique in
$SOOTSRC/src/soot/tools/CFGViewer.jar, which constructs a
BodyTransformer to create visualizations of CFGs, and adds it
to Soot's jtp pack.

Indirectly, CFGViewer even provides an example of generating
BlockGraphs from input bodies, but the logic that does this is
probably difficult to follow, since it uses an (overly?)
elaborate set of classes (in $SOOTSRC/soot/util/cfgcmd) to
separate the code that determines what sort of graph to produce
from the code that produces the graph.

One of the choices you will have to make if you take this
approach will be the appropriate phase in Soot's processing for
your BodyTransformer to be called.  There is a discussion of what
the various phases do in the Phase Options tutorial
($SOOTSRC/tutorial/phase/phase{html,pdf,ps}), but you might
need to look at the source to the PackManager to decide where to
put your Transformer.



More information about the Soot-list mailing list