public soot.util.PhaseDumper soot_util_PhaseDumper() { if (instance_soot_util_PhaseDumper == null) { synchronized (this) { if (instance_soot_util_PhaseDumper == null) instance_soot_util_PhaseDumper = new soot.util.PhaseDumper(g); } } return instance_soot_util_PhaseDumper; } protected void release_soot_util_PhaseDumper() {
/** * Tells the <code>PhaseDumper</code> that a {@link Body} transforming phase has started, so that it can dump the phases's * “before” file. If the phase is to be dumped, <code>dumpBefore</code> deletes any old graph files dumped * during previous runs of the phase. * * @param b * the {@link Body} being transformed. * @param phaseName * the name of the phase that has just started. */ public void dumpBefore(Body b, String phaseName) { phaseStack.push(phaseName); if (isBodyDumpingPhase(phaseName)) { deleteOldGraphFiles(b, phaseName); dumpBody(b, phaseName + ".in"); } }
/** * Tells the <code>PhaseDumper</code> that a {@link Scene} transforming phase has started, so that it can dump the phases's * “before” files. If the phase is to be dumped, <code>dumpBefore</code> deletes any old graph files dumped * during previous runs of the phase. * * @param phaseName * the name of the phase that has just started. */ public void dumpBefore(String phaseName) { phaseStack.push(phaseName); if (isBodyDumpingPhase(phaseName)) { dumpAllBodies(phaseName + ".in", true); } }
/** * Constructs a {@link BriefBlockGraph} representing the <tt>Unit</tt>-level control flow represented by the passed * {@link BriefUnitGraph}. * * @param unitGraph * the {@link Body} for which to build a graph. */ public BriefBlockGraph(BriefUnitGraph unitGraph) { super(unitGraph); soot.util.PhaseDumper.v().dumpGraph(this, mBody); } }
public void apply() { Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName); if (PhaseOptions.getBoolean(options, "enabled")) { if (Options.v().verbose()) { logger.debug("" + "Applying phase " + phaseName + " to the scene."); } } if (DEBUG) { PhaseDumper.v().dumpBefore(getPhaseName()); } ((SceneTransformer) t).transform(phaseName, options); if (DEBUG) { PhaseDumper.v().dumpAfter(getPhaseName()); } }
alreadyDumping = true; String phaseName = phaseStack.currentPhase(); if (isCFGDumpingPhase(phaseName)) { try { String outputFile = nextGraphFileName(b, phaseName + "-" + getClassIdent(g) + "-"); DotGraph dotGraph = new CFGToDotGraph().drawCFG(g, b); dotGraph.plot(outputFile);
/** * Tells the <code>PhaseDumper</code> that a {@link Body} transforming phase has ended, so that it can dump the phases's * “after” file. * * @param b * the {@link Body} being transformed. * * @param phaseName * the name of the phase that has just ended. * * @throws IllegalArgumentException * if <code>phaseName</code> does not match the <code>PhaseDumper</code>'s record of the current phase. */ public void dumpAfter(Body b, String phaseName) { String poppedPhaseName = phaseStack.pop(); if (poppedPhaseName != phaseName) { throw new IllegalArgumentException("dumpAfter(" + phaseName + ") when poppedPhaseName == " + poppedPhaseName); } if (isBodyDumpingPhase(phaseName)) { dumpBody(b, phaseName + ".out"); } }
private void dumpAllBodies(String baseName, boolean deleteGraphFiles) { List<SootClass> classes = Scene.v().getClasses(SootClass.BODIES); for (SootClass cls : classes) { for (Iterator m = cls.getMethods().iterator(); m.hasNext();) { SootMethod method = (SootMethod) m.next(); if (method.hasActiveBody()) { Body body = method.getActiveBody(); if (deleteGraphFiles) { deleteOldGraphFiles(body, baseName); } dumpBody(body, baseName); } } } }
public void apply(Body b) { Map<String, String> options = PhaseOptions.v().getPhaseOptions(phaseName); if (PhaseOptions.getBoolean(options, "enabled")) { if (Options.v().verbose()) { logger.debug("" + "Applying phase " + phaseName + " to " + b.getMethod() + "."); } } if (DEBUG) { PhaseDumper.v().dumpBefore(b, getPhaseName()); } ((BodyTransformer) t).transform(b, phaseName, options); if (DEBUG) { PhaseDumper.v().dumpAfter(b, getPhaseName()); } }
alreadyDumping = true; String phaseName = phaseStack.currentPhase(); if (isCFGDumpingPhase(phaseName)) { try { String outputFile = nextGraphFileName(g.getBody(), phaseName + "-" + getClassIdent(g) + "-"); CFGToDotGraph drawer = new CFGToDotGraph(); drawer.setShowExceptions(Options.v().show_exception_dests());
/** * Constructs a <tt>ZonedBlockGraph</tt> corresponding to the <tt>Unit</tt>-level control flow represented by the passed * {@link BriefUnitGraph}. * * @param unitGraph * The <tt>BriefUnitGraph</tt> for which to produce a <tt>ZonedBlockGraph</tt>. */ public ZonedBlockGraph(BriefUnitGraph unitGraph) { super(unitGraph); soot.util.PhaseDumper.v().dumpGraph(this, mBody); }
public void writeOutput() { setupJAR(); if (Options.v().verbose()) { PhaseDumper.v().dumpBefore("output"); } if (Options.v().output_format() == Options.output_format_dava) { postProcessDAVA(); outputDava(); } else if (Options.v().output_format() == Options.output_format_dex || Options.v().output_format() == Options.output_format_force_dex) { writeDexOutput(); } else { writeOutput(reachableClasses()); tearDownJAR(); } postProcessXML(reachableClasses()); if (!Options.v().no_writeout_body_releasing()) { releaseBodies(reachableClasses()); } if (Options.v().verbose()) { PhaseDumper.v().dumpAfter("output"); } }
/** * Tells the <code>PhaseDumper</code> that a {@link Scene} transforming phase has ended, so that it can dump the phases's * “after” files. * * @param phaseName * the name of the phase that has just ended. * * @throws IllegalArgumentException * if <code>phaseName</code> does not match the <code>PhaseDumper</code>'s record of the current phase. */ public void dumpAfter(String phaseName) { String poppedPhaseName = phaseStack.pop(); if (poppedPhaseName != phaseName) { throw new IllegalArgumentException("dumpAfter(" + phaseName + ") when poppedPhaseName == " + poppedPhaseName); } if (isBodyDumpingPhase(phaseName)) { dumpAllBodies(phaseName + ".out", false); } }
/** * Constructs an <tt>ArrayRefBlockGraph</tt> corresponding to the <tt>Unit</tt>-level control flow represented by the * passed {@link BriefUnitGraph}. * * @param unitGraph * The <tt>BriefUnitGraph</tt> for which to build an <tt>ArrayRefBlockGraph</tt>. */ public ArrayRefBlockGraph(BriefUnitGraph unitGraph) { super(unitGraph); soot.util.PhaseDumper.v().dumpGraph(this, mBody); }
/** * Constructs a graph for the blocks found by partitioning the the {@link Unit}s in an {@link ExceptionalUnitGraph}. * * @param unitGraph * The <code>ExceptionalUnitGraph</code> whose <code>Unit</code>s are to be split into blocks. */ public ExceptionalBlockGraph(ExceptionalUnitGraph unitGraph) { super(unitGraph); soot.util.PhaseDumper.v().dumpGraph(this); }
/** * Constructs a graph for the blocks found by partitioning the the units in a {@link ClassicCompleteUnitGraph}. * * @param unitGraph * A {@link ClassicCompleteUnitGraph} built from <tt>body</tt>. The <tt>CompleteBlockGraph</tt> constructor uses * the passed <tt>graph</tt> to split the body into blocks. */ public ClassicCompleteBlockGraph(ClassicCompleteUnitGraph unitGraph) { super(unitGraph); // Adjust the heads and tails to match the old CompleteBlockGraph. Unit entryPoint = getBody().getUnits().getFirst(); List<Block> newHeads = new ArrayList<Block>(1); for (Block b : getBlocks()) { if (b.getHead() == entryPoint) { newHeads.add(b); break; } } mHeads = Collections.unmodifiableList(newHeads); mTails = Collections.emptyList(); soot.util.PhaseDumper.v().dumpGraph(this, mBody); } }
/** * Constructs a BriefUnitGraph given a Body instance. * * @param body * The underlying body we want to make a graph for. */ public BriefUnitGraph(Body body) { super(body); int size = unitChain.size(); if (Options.v().time()) { Timers.v().graphTimer.start(); } unitToSuccs = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f); unitToPreds = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f); buildUnexceptionalEdges(unitToSuccs, unitToPreds); buildHeadsAndTails(); if (Options.v().time()) { Timers.v().graphTimer.end(); } soot.util.PhaseDumper.v().dumpGraph(this, body); }
/** * Constructs the graph from a given Body instance. * * @param the * Body instance from which the graph is built. */ public TrapUnitGraph(Body body) { super(body); int size = unitChain.size(); if (Options.v().time()) { Timers.v().graphTimer.start(); } unitToSuccs = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f); unitToPreds = new HashMap<Unit, List<Unit>>(size * 2 + 1, 0.7f); buildUnexceptionalEdges(unitToSuccs, unitToPreds); buildExceptionalEdges(unitToSuccs, unitToPreds); buildHeadsAndTails(); if (Options.v().time()) { Timers.v().graphTimer.end(); } soot.util.PhaseDumper.v().dumpGraph(this, body); }