use of soot.util.cfgcmd.CFGToDotGraph in project soot by Sable.
the class PhaseDumper method dumpGraph.
/**
* Asks the <code>PhaseDumper</code> to dump the passed {@link
* ExceptionalGraph} if the current phase is being dumped.
*
* @param g the graph to dump.
*/
public void dumpGraph(ExceptionalGraph g) {
if (alreadyDumping) {
return;
}
try {
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());
DotGraph dotGraph = drawer.drawCFG(g);
dotGraph.plot(outputFile);
} catch (java.io.IOException e) {
// Don't abort execution because of an I/O error, but
// report the error.
logger.debug("PhaseDumper.dumpBody() caught: " + e.toString());
logger.error(e.getMessage(), e);
}
}
} finally {
alreadyDumping = false;
}
}
use of soot.util.cfgcmd.CFGToDotGraph in project soot by Sable.
the class CFGViewer method initialize.
private void initialize(Map<String, String> options) {
if (drawer == null) {
drawer = new CFGToDotGraph();
drawer.setBriefLabels(PhaseOptions.getBoolean(options, briefLabelOptionName));
drawer.setOnePage(!PhaseOptions.getBoolean(options, multipageOptionName));
drawer.setUnexceptionalControlFlowAttr("color", "black");
drawer.setExceptionalControlFlowAttr("color", "red");
drawer.setExceptionEdgeAttr("color", "lightgray");
drawer.setShowExceptions(Options.v().show_exception_dests());
ir = CFGIntermediateRep.getIR(PhaseOptions.getString(options, irOptionName));
graphtype = CFGGraphType.getGraphType(PhaseOptions.getString(options, graphTypeOptionName));
AltClassLoader.v().setAltClassPath(PhaseOptions.getString(options, altClassPathOptionName));
AltClassLoader.v().setAltClasses(new String[] { "soot.toolkits.graph.ArrayRefBlockGraph", "soot.toolkits.graph.Block", "soot.toolkits.graph.Block$AllMapTo", "soot.toolkits.graph.BlockGraph", "soot.toolkits.graph.BriefBlockGraph", "soot.toolkits.graph.BriefUnitGraph", "soot.toolkits.graph.CompleteBlockGraph", "soot.toolkits.graph.CompleteUnitGraph", "soot.toolkits.graph.TrapUnitGraph", "soot.toolkits.graph.UnitGraph", "soot.toolkits.graph.ZonedBlockGraph" });
}
}
use of soot.util.cfgcmd.CFGToDotGraph in project soot by Sable.
the class PhaseDumper method dumpGraph.
/**
* Asks the <code>PhaseDumper</code> to dump the passed {@link
* DirectedGraph} if the current phase is being dumped.
*
* @param g the graph to dump.
*
* @param body the {@link Body} represented by <code>g</code>.
*/
public void dumpGraph(DirectedGraph g, Body b) {
if (alreadyDumping) {
return;
}
try {
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);
} catch (java.io.IOException e) {
// Don't abort execution because of an I/O error, but
// report the error.
logger.debug("PhaseDumper.dumpBody() caught: " + e.toString());
logger.error(e.getMessage(), e);
}
}
} finally {
alreadyDumping = false;
}
}
Aggregations