Package soot.util

Class 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.
    • 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 <N> void dumpGraph​(DirectedGraph<N> g,
                                  Body b)
        Asks the PhaseDumper to dump the passed DirectedGraph if the current phase is being dumped.
        Parameters:
        g - the graph to dump.
        b - the Body represented by g.
      • dumpGraph

        public <N> void dumpGraph​(DirectedGraph<N> g,
                                  Body b,
                                  boolean skipPhaseCheck)
        Asks the PhaseDumper to dump the passed DirectedGraph if the current phase is being dumped or skipPhaseCheck == true.
        Parameters:
        g - the graph to dump.
        b - the Body represented by g.
        skipPhaseCheck -
      • dumpGraph

        public <N> void dumpGraph​(ExceptionalGraph<N> g)
        Asks the PhaseDumper to dump the passed ExceptionalGraph if the current phase is being dumped.
        Parameters:
        g - the graph to dump.
      • dumpGraph

        public <N> void dumpGraph​(ExceptionalGraph<N> g,
                                  boolean skipPhaseCheck)
        Asks the PhaseDumper to dump the passed ExceptionalGraph if the current phase is being dumped or skipPhaseCheck == 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!