public class DOTCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>> extends AbstractCFGVisualizer<V,S,T>
Modifier and Type | Field and Description |
---|---|
protected @Nullable String |
checkerName
The (optional) checker name.
|
protected Map<String,String> |
generated
Mapping from class/method representation to generated dot file.
|
protected static String |
leftJustifiedTerminator
Terminator for lines that are left-justified.
|
protected String |
outDir
The output directory.
|
lineSeparator, storeEntryIndent, verbose
Constructor and Description |
---|
DOTCFGVisualizer() |
Modifier and Type | Method and Description |
---|---|
protected String |
addEdge(long sId,
long eId,
String flowRule)
Generate the String representation of an edge.
|
protected String |
dotOutputFileName(UnderlyingAST ast)
Create a dot file and return its name.
|
protected String |
format(Object obj)
Format the given object as a String suitable for the output format, i.e.
|
void |
init(Map<String,Object> args)
Initialization method guaranteed to be called once before the first invocation of
CFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>) . |
void |
shutdown()
Write a file
methods.txt that contains a mapping from source code location to
generated dot file. |
@Nullable Map<String,Object> |
visualize(ControlFlowGraph cfg,
Block entry,
@Nullable Analysis<V,S,T> analysis)
Output a visualization representing the control flow graph starting at
entry . |
String |
visualizeBlock(Block bb,
@Nullable Analysis<V,S,T> analysis)
Visualize a block based on the analysis.
|
String |
visualizeBlockTransferInputAfter(Block bb,
Analysis<V,S,T> analysis)
Visualize the transferInput after a Block based on the analysis.
|
String |
visualizeBlockTransferInputBefore(Block bb,
Analysis<V,S,T> analysis)
Visualize the transferInput before a Block based on the analysis.
|
String |
visualizeConditionalBlock(ConditionalBlock cbb)
Visualize a ConditionalBlock.
|
protected String |
visualizeGraphFooter()
Return the footer of the generated graph.
|
protected String |
visualizeGraphHeader()
Return the header of the generated graph.
|
String |
visualizeNodes(Set<Block> blocks,
ControlFlowGraph cfg,
@Nullable Analysis<V,S,T> analysis)
Generate the String representation of the nodes of a control flow graph.
|
String |
visualizeSpecialBlock(SpecialBlock sbb)
Visualize a SpecialBlock.
|
String |
visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue,
V value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of arrays
collected by this Store. |
String |
visualizeStoreClassVals(FlowExpressions.ClassName className,
V value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of class names
collected by this Store. |
String |
visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess,
V value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of fields
collected by this Store. |
String |
visualizeStoreFooter()
Called by
CFAbstractStore to visualize any information after the invocation of CFAbstractStore#internalVisualize() . |
String |
visualizeStoreHeader(String classCanonicalName)
Called by a
CFAbstractStore to visualize the class name before calling the CFAbstractStore#internalVisualize() method. |
String |
visualizeStoreKeyVal(String keyName,
Object value)
Called by
CFAbstractStore#internalVisualize() to visualize the specific information
collected according to the specific kind of Store. |
String |
visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar,
V value)
Called by
CFAbstractStore#internalVisualize() to visualize a local variable. |
String |
visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall,
V value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of pure method
calls collected by this Store. |
String |
visualizeStoreThisVal(V value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of the current
object this in this Store. |
addBlock, addBlockContent, getLastNode, getNodeSimpleName, getProcessOrder, getProcessOrderSimpleString, handleSuccessorsHelper, loopOverBlockContents, visualizeBlockHelper, visualizeBlockNode, visualizeBlockTransferInputAfterHelper, visualizeBlockTransferInputBeforeHelper, visualizeGraph, visualizeGraphWithoutHeaderAndFooter, visualizeSpecialBlockHelper, visualizeStore
protected String outDir
protected @Nullable String checkerName
protected Map<String,String> generated
protected static final String leftJustifiedTerminator
public void init(Map<String,Object> args)
CFGVisualizer
CFGVisualizer.visualize(org.checkerframework.dataflow.cfg.ControlFlowGraph, org.checkerframework.dataflow.cfg.block.Block, org.checkerframework.dataflow.analysis.Analysis<V, S, T>)
.init
in interface CFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
init
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
args
- implementation-dependent optionspublic @Nullable Map<String,Object> visualize(ControlFlowGraph cfg, Block entry, @Nullable Analysis<V,S,T> analysis)
CFGVisualizer
entry
. The
concrete actions are implementation dependent.
An invocation visualize(cfg, entry, null);
does not output stores at the beginning
of basic blocks.
cfg
- the CFG to visualizeentry
- the entry node of the control flow graph to be representedanalysis
- an analysis containing information about the program represented by the CFG.
The information includes Store
s that are valid at the beginning of basic blocks
reachable from entry
and per-node information for value producing Node
s.
Can also be null
to indicate that this information should not be output.DOTCFGVisualizer
) or a
String representation of the CFG (StringCFGVisualizer
)public String visualizeNodes(Set<Block> blocks, ControlFlowGraph cfg, @Nullable Analysis<V,S,T> analysis)
AbstractCFGVisualizer
visualizeNodes
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
blocks
- the set of all the blocks in a control flow graphcfg
- the control flow graphanalysis
- the current analysisprotected String addEdge(long sId, long eId, String flowRule)
AbstractCFGVisualizer
addEdge
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
sId
- the ID of current blockeId
- the ID of successor blockflowRule
- the content of the edgepublic String visualizeBlock(Block bb, @Nullable Analysis<V,S,T> analysis)
CFGVisualizer
bb
- the blockanalysis
- the current analysispublic String visualizeSpecialBlock(SpecialBlock sbb)
CFGVisualizer
sbb
- the special blocksbb
: entry, exit,
or exceptional-exitpublic String visualizeConditionalBlock(ConditionalBlock cbb)
CFGVisualizer
cbb
- the conditional blockpublic String visualizeBlockTransferInputBefore(Block bb, Analysis<V,S,T> analysis)
CFGVisualizer
bb
- the blockanalysis
- the current analysispublic String visualizeBlockTransferInputAfter(Block bb, Analysis<V,S,T> analysis)
CFGVisualizer
bb
- the blockanalysis
- the current analysisprotected String dotOutputFileName(UnderlyingAST ast)
ast
- an abstract syntax treeprotected String format(Object obj)
AbstractCFGVisualizer
format
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
obj
- an objectpublic String visualizeStoreThisVal(V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of the current
object this
in this Store.value
- the value of the current object this
this
public String visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar, V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize a local variable.localVar
- the local variablevalue
- the value of the local variablepublic String visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess, V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of fields
collected by this Store.fieldAccess
- the fieldvalue
- the value of the fieldpublic String visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue, V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of arrays
collected by this Store.arrayValue
- the arrayvalue
- the value of the arraypublic String visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall, V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of pure method
calls collected by this Store.methodCall
- the pure method callvalue
- the value of the pure method callpublic String visualizeStoreClassVals(FlowExpressions.ClassName className, V value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of class names
collected by this Store.className
- the class namevalue
- the value of the class namepublic String visualizeStoreKeyVal(String keyName, Object value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the specific information
collected according to the specific kind of Store. Currently, these Stores call this method:
LockStore
, NullnessStore
, and InitializationStore
to visualize
additional information.keyName
- the name of the specific information to be visualizedvalue
- the value of the specific information to be visualizedpublic String visualizeStoreHeader(String classCanonicalName)
CFGVisualizer
CFAbstractStore
to visualize the class name before calling the CFAbstractStore#internalVisualize()
method.classCanonicalName
- the canonical name of the classpublic String visualizeStoreFooter()
CFGVisualizer
CFAbstractStore
to visualize any information after the invocation of CFAbstractStore#internalVisualize()
.public void shutdown()
methods.txt
that contains a mapping from source code location to
generated dot file.protected String visualizeGraphHeader()
AbstractCFGVisualizer
visualizeGraphHeader
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>
protected String visualizeGraphFooter()
AbstractCFGVisualizer
visualizeGraphFooter
in class AbstractCFGVisualizer<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>