soot.util
Class PhaseDumper

java.lang.Object
  extended by soot.util.PhaseDumper

public class PhaseDumper
extends Object

The PhaseDumper is a debugging aid. It maintains two lists of phases to be debugged. If a phase is on the bodyDumpingPhases list, then the intermediate representation of the bodies being manipulated by the phase is dumped before and after the phase is applied. If a phase is on the cfgDumpingPhases list, then whenever a CFG is constructed during the phase, a dot file is dumped representing the CFG constructed.


Constructor Summary
PhaseDumper(Singletons.Global g)
           
 
Method Summary
 void dumpAfter(Body b, String phaseName)
          Tells the PhaseDumper that a Body transforming phase has ended, so that it can dump the phases's “after” file.
 void dumpAfter(String phaseName)
          Tells the PhaseDumper that a Scene transforming phase has ended, so that it can dump the phases's “after” files.
 void dumpBefore(Body b, String phaseName)
          Tells the PhaseDumper that a Body transforming phase has started, so that it can dump the phases's “before” file.
 void dumpBefore(String phaseName)
          Tells the PhaseDumper that a Scene transforming phase has started, so that it can dump the phases's “before” files.
 void dumpBody(Body b, String baseName)
           
 void dumpGraph(DirectedGraph g, Body b)
          Asks the PhaseDumper to dump the passed DirectedGraph if the current phase is being dumped.
 void dumpGraph(ExceptionalGraph g)
          Asks the PhaseDumper to dump the passed ExceptionalGraph if the current phase is being dumped.
 void printCurrentStackTrace()
          Prints the current stack trace, as a brute force tool for program understanding.
static PhaseDumper v()
          Returns the single instance of PhaseDumper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhaseDumper

public PhaseDumper(Singletons.Global g)
Method Detail

v

public static PhaseDumper v()
Returns the single instance of PhaseDumper.

Returns:
Soot's PhaseDumper.

dumpBody

public void dumpBody(Body b,
                     String baseName)

dumpBefore

public void dumpBefore(Body b,
                       String phaseName)
Tells the PhaseDumper that a Body transforming phase has started, so that it can dump the phases's “before” file. If the phase is to be dumped, dumpBefore deletes any old graph files dumped during previous runs of the phase.

Parameters:
b - the Body being transformed.
phaseName - the name of the phase that has just started.

dumpAfter

public void dumpAfter(Body b,
                      String phaseName)
Tells the PhaseDumper that a Body transforming phase has ended, so that it can dump the phases's “after” file.

Parameters:
b - the Body being transformed.
phaseName - the name of the phase that has just ended.
Throws:
IllegalArgumentException - if phaseName does not match the PhaseDumper's record of the current phase.

dumpBefore

public void dumpBefore(String phaseName)
Tells the PhaseDumper that a Scene transforming phase has started, so that it can dump the phases's “before” files. If the phase is to be dumped, dumpBefore deletes any old graph files dumped during previous runs of the phase.

Parameters:
phaseName - the name of the phase that has just started.

dumpAfter

public void dumpAfter(String phaseName)
Tells the PhaseDumper that a Scene transforming phase has ended, so that it can dump the phases's “after” files.

Parameters:
phaseName - the name of the phase that has just ended.
Throws:
IllegalArgumentException - if phaseName does not match the PhaseDumper's record of the current phase.

dumpGraph

public void dumpGraph(DirectedGraph g,
                      Body b)
Asks the PhaseDumper to dump the passed DirectedGraph if the current phase is being dumped.

Parameters:
g - the graph to dump.
body - the Body represented by g.

dumpGraph

public void dumpGraph(ExceptionalGraph g)
Asks the PhaseDumper to dump the passed ExceptionalGraph if the current phase is being dumped.

Parameters:
g - the graph to dump.

printCurrentStackTrace

public void printCurrentStackTrace()
Prints the current stack trace, as a brute force tool for program understanding. This method appeared in response to the many times dumpGraph() was being called while the phase stack was empty. Turned out that the Printer needs to build a BriefUnitGraph in order to print a graph. Doh!