Package soot.util.cfgcmd
Class CFGToDotGraph
- java.lang.Object
-
- soot.util.cfgcmd.CFGToDotGraph
-
-
Constructor Summary
Constructors Constructor Description CFGToDotGraph()Returns a CFGToDotGraph converter which will draw the graph as a single arbitrarily-sized page, with full-length node labels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <N> DotGraphdrawCFG(DirectedGraph<N> graph, Body body)Create aDotGraphwhose nodes and edges depict a control flow graph without distinguished exceptional edges.<N> DotGraphdrawCFG(ExceptionalGraph<N> graph)Create aDotGraphwhose nodes and edges depict the control flow in aExceptionalGraph, with distinguished edges for exceptional control flow.voidsetBriefLabels(boolean useBrief)Specify whether to abbreviate the text in node labels.voidsetExceptionalControlFlowAttr(String id, String value)Specify the dot graph attribute to use for exceptional control flow edges.voidsetExceptionEdgeAttr(String id, String value)Specify the dot graph attribute to use for edges depicting the exceptions each node may throw, and their handlers.voidsetHeadAttr(String id, String value)Specify the dot graph attribute to use for head nodes (in addition to filling in the nodes).voidsetOnePage(boolean onePage)Specify whether to split the graph into pages.voidsetShowExceptions(boolean showExceptions)Specify whether the graph should depict the exceptions which each node may throw, in the form of an edge from the throwing node to the handler (if any), labeled with the possible exception types.voidsetTailAttr(String id, String value)Specify the dot graph attribute to use for tail nodes (in addition to filling in the nodes).voidsetUnexceptionalControlFlowAttr(String id, String value)Specify the dot graph attribute to use for regular control flow edges.
-
-
-
Constructor Detail
-
CFGToDotGraph
public CFGToDotGraph()
Returns a CFGToDotGraph converter which will draw the graph as a single arbitrarily-sized page, with full-length node labels.
If asked to draw a
ExceptionalGraph, the converter will identify the exceptions that will be thrown. By default, it will distinguish different edges by coloring regular control flow edges black, exceptional control flow edges red, and thrown exception edges light gray. Head and tail nodes are filled in, head nodes with gray, and tail nodes with light gray.
-
-
Method Detail
-
setOnePage
public void setOnePage(boolean onePage)
Specify whether to split the graph into pages.- Parameters:
onePage- indicates whether to produce the graph as a single, arbitrarily-sized page (ifonePageistrue) or several 8.5x11-inch pages (ifonePageisfalse).
-
setBriefLabels
public void setBriefLabels(boolean useBrief)
Specify whether to abbreviate the text in node labels. This is most relevant when the nodes represent basic blocks: abbreviated node labels contain only a numeric label for the block, while unabbreviated labels contain the code of its instructions.- Parameters:
useBrief- indicates whether to abbreviate the text of node labels.
-
setShowExceptions
public void setShowExceptions(boolean showExceptions)
Specify whether the graph should depict the exceptions which each node may throw, in the form of an edge from the throwing node to the handler (if any), labeled with the possible exception types. This parameter has an effect only when drawingExceptionalGraphs.- Parameters:
showExceptions- indicates whether to show possible exceptions and their handlers.
-
setUnexceptionalControlFlowAttr
public void setUnexceptionalControlFlowAttr(String id, String value)
Specify the dot graph attribute to use for regular control flow edges. This parameter has an effect only when drawingExceptionalGraphs.- Parameters:
id- The attribute name, for example "style" or "color".value- The attribute value, for example "solid" or "black".- See Also:
- "Drawing graphs with dot"
-
setExceptionalControlFlowAttr
public void setExceptionalControlFlowAttr(String id, String value)
Specify the dot graph attribute to use for exceptional control flow edges. This parameter has an effect only when drawingExceptionalGraphs.- Parameters:
id- The attribute name, for example "style" or "color".value- The attribute value, for example "dashed" or "red".- See Also:
- "Drawing graphs with dot"
-
setExceptionEdgeAttr
public void setExceptionEdgeAttr(String id, String value)
Specify the dot graph attribute to use for edges depicting the exceptions each node may throw, and their handlers. This parameter has an effect only when drawingExceptionalGraphs.- Parameters:
id- The attribute name, for example "style" or "color".value- The attribute value, for example "dotted" or "lightgray".- See Also:
- "Drawing graphs with dot"
-
setHeadAttr
public void setHeadAttr(String id, String value)
Specify the dot graph attribute to use for head nodes (in addition to filling in the nodes).- Parameters:
id- The attribute name, for example "fillcolor".value- The attribute value, for example "gray".- See Also:
- "Drawing graphs with dot"
-
setTailAttr
public void setTailAttr(String id, String value)
Specify the dot graph attribute to use for tail nodes (in addition to filling in the nodes).- Parameters:
id- The attribute name, for example "fillcolor".value- The attribute value, for example "lightgray".- See Also:
- "Drawing graphs with dot"
-
drawCFG
public <N> DotGraph drawCFG(DirectedGraph<N> graph, Body body)
Create aDotGraphwhose nodes and edges depict a control flow graph without distinguished exceptional edges.- Parameters:
graph- aDirectedGraphrepresenting a CFG (probably an instance ofUnitGraph,BlockGraph, or one of their subclasses).body- theBodyrepresented bygraph(used to format the text within nodes). If no body is available, passnull.- Returns:
- a visualization of
graph.
-
drawCFG
public <N> DotGraph drawCFG(ExceptionalGraph<N> graph)
Create aDotGraphwhose nodes and edges depict the control flow in aExceptionalGraph, with distinguished edges for exceptional control flow.- Parameters:
graph- the control flow graph- Returns:
- a visualization of
graph.
-
-