Package soot.util
Class PhaseDumper
- java.lang.Object
-
- 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 thebodyDumpingPhaseslist, 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 thecfgDumpingPhaseslist, then whenever a CFG is constructed during the phase, a dot file is dumped representing the CFG constructed.
-
-
Constructor Summary
Constructors Constructor Description PhaseDumper(Singletons.Global g)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddumpAfter(String phaseName)Tells thePhaseDumperthat aScenetransforming phase has ended, so that it can dump the phases's “after” files.voiddumpAfter(Body b, String phaseName)Tells thePhaseDumperthat aBodytransforming phase has ended, so that it can dump the phases's “after” file.voiddumpBefore(String phaseName)Tells thePhaseDumperthat aScenetransforming phase has started, so that it can dump the phases's “before” files.voiddumpBefore(Body b, String phaseName)Tells thePhaseDumperthat aBodytransforming phase has started, so that it can dump the phases's “before” file.voiddumpBody(Body b, String baseName)<N> voiddumpGraph(DirectedGraph<N> g, Body b)Asks thePhaseDumperto dump the passedDirectedGraphif the current phase is being dumped.<N> voiddumpGraph(DirectedGraph<N> g, Body b, boolean skipPhaseCheck)Asks thePhaseDumperto dump the passedDirectedGraphif the current phase is being dumped orskipPhaseCheck == true.<N> voiddumpGraph(ExceptionalGraph<N> g)Asks thePhaseDumperto dump the passedExceptionalGraphif the current phase is being dumped.<N> voiddumpGraph(ExceptionalGraph<N> g, boolean skipPhaseCheck)Asks thePhaseDumperto dump the passedExceptionalGraphif the current phase is being dumped orskipPhaseCheck == true.voidprintCurrentStackTrace()Prints the current stack trace, as a brute force tool for program understanding.static PhaseDumperv()Returns the single instance ofPhaseDumper.
-
-
-
Constructor Detail
-
PhaseDumper
public PhaseDumper(Singletons.Global g)
-
-
Method Detail
-
v
public static PhaseDumper v()
Returns the single instance ofPhaseDumper.- Returns:
- Soot's
PhaseDumper.
-
dumpBefore
public void dumpBefore(Body b, String phaseName)
Tells thePhaseDumperthat aBodytransforming phase has started, so that it can dump the phases's “before” file. If the phase is to be dumped,dumpBeforedeletes any old graph files dumped during previous runs of the phase.- Parameters:
b- theBodybeing transformed.phaseName- the name of the phase that has just started.
-
dumpAfter
public void dumpAfter(Body b, String phaseName)
Tells thePhaseDumperthat aBodytransforming phase has ended, so that it can dump the phases's “after” file.- Parameters:
b- theBodybeing transformed.phaseName- the name of the phase that has just ended.- Throws:
IllegalArgumentException- ifphaseNamedoes not match thePhaseDumper's record of the current phase.
-
dumpBefore
public void dumpBefore(String phaseName)
Tells thePhaseDumperthat aScenetransforming phase has started, so that it can dump the phases's “before” files. If the phase is to be dumped,dumpBeforedeletes 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 thePhaseDumperthat aScenetransforming 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- ifphaseNamedoes not match thePhaseDumper's record of the current phase.
-
dumpGraph
public <N> void dumpGraph(DirectedGraph<N> g, Body b)
Asks thePhaseDumperto dump the passedDirectedGraphif the current phase is being dumped.- Parameters:
g- the graph to dump.b- theBodyrepresented byg.
-
dumpGraph
public <N> void dumpGraph(DirectedGraph<N> g, Body b, boolean skipPhaseCheck)
Asks thePhaseDumperto dump the passedDirectedGraphif the current phase is being dumped orskipPhaseCheck == true.- Parameters:
g- the graph to dump.b- theBodyrepresented byg.skipPhaseCheck-
-
dumpGraph
public <N> void dumpGraph(ExceptionalGraph<N> g)
Asks thePhaseDumperto dump the passedExceptionalGraphif the current phase is being dumped.- Parameters:
g- the graph to dump.
-
dumpGraph
public <N> void dumpGraph(ExceptionalGraph<N> g, boolean skipPhaseCheck)
Asks thePhaseDumperto dump the passedExceptionalGraphif the current phase is being dumped orskipPhaseCheck == true.- Parameters:
g- the graph to dump.skipPhaseCheck-
-
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!
-
-