[Soot-list] Creating and Modifiying Dominator Trees? (and Various
Questions)
Eric Bodden
eric.bodden at mail.mcgill.ca
Mon Mar 5 20:11:18 EST 2007
On 3/5/07, Ryan Rueth <rrueth at gmail.com> wrote:
> So far, I believe I would just have to create a Transformer, but I'm not
> sure which I would extend. I want to create a DominatorTree for the entire
> .class file, so would I be extending SceneTransformer?
What do you mean by a dominator tree of a class file? Domination only
makes sense intraprocedurally. So you surely want to have a tree for
each method separately, don't you?
> If I made this a
> BodyTransformer, would that mean that I was only transforming each
> individual body of code (for example method1() and method2() would each be
> transformed separately and not integrated into a single DomintatorTree,
> assuming that method1 and method2 could actually be in the same Tree)?
A dominator tree holds no methods, it holds statements. What's your
notion of a dominator tree?
> So far, I have found the DominatorTree class
> (http://www.sable.mcgill.ca/soot/doc/soot/toolkits/graph/DominatorTree.html)
> and I understand that I will need a DominatorsFinder class to pass the
> DominatorTree constructor, thus I'd probably use the SimpleDominatorsFinder
> (http://www.sable.mcgill.ca/soot/doc/soot/toolkits/graph/SimpleDominatorsFinder.html).
> In addition to that I'd need a DirectedGraph to pass that constructor, so I
> was thinking about using something like the ExceptionalUnitGraph
> (http://www.sable.mcgill.ca/soot/doc/soot/toolkits/graph/ExceptionalUnitGraph.html),
> but would this actually give me the DominatorTree for the entire .class file
> that I passed in? It seems like it only creates a graph for a single Body
> instance?
What you describe is the correct way of getting a dominator tree for a
*single method*... (1) create an ExceptionalUnitGraph for the method's
body (2) use SimpleDominatorsFinder to create a dominator tree.
There's no way of getting such information for an entire class and I
frankly don't see how this would make sense.
Eric
--
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada
More information about the Soot-list
mailing list