public class DOTCFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>> extends Object implements CFGVisualizer<A,S,T>
Modifier and Type | Field and Description |
---|---|
protected String |
checkerName |
protected Map<String,String> |
generated
Mapping from class/method representation to generated dot file.
|
protected String |
outdir |
protected StringBuilder |
sbBlock |
protected StringBuilder |
sbDigraph |
protected StringBuilder |
sbStore |
protected boolean |
verbose |
Constructor and Description |
---|
DOTCFGVisualizer() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDotEdge(long sId,
long eId,
String labelContent) |
protected String |
dotOutputFileName(UnderlyingAST ast) |
protected String |
escapeDoubleQuotes(String str) |
protected String |
generateDotGraph(ControlFlowGraph cfg,
Block entry,
@Nullable Analysis<A,S,T> analysis)
Generate the dot representation as String.
|
protected void |
generateDotNodes(Set<Block> visited,
ControlFlowGraph cfg,
@Nullable Analysis<A,S,T> analysis) |
protected IdentityHashMap<Block,List<Integer>> |
getProcessOrder(ControlFlowGraph cfg) |
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<A, S, T>) . |
protected String |
prepareNodeType(Node t) |
protected String |
prepareString(String s) |
void |
shutdown()
Write a file
methods.txt that contains a mapping from source code location to
generated dot file. |
protected String |
toStringEscapeDoubleQuotes(Object obj) |
@Nullable Map<String,Object> |
visualize(ControlFlowGraph cfg,
Block entry,
@Nullable Analysis<A,S,T> analysis)
Output a visualization representing the control flow graph starting at
entry . |
void |
visualizeBlock(Block bb,
@Nullable Analysis<A,S,T> analysis)
Produce a representation of the contests of a basic block.
|
void |
visualizeBlockNode(Node t,
@Nullable Analysis<A,S,T> analysis)
Visualize a Node based on the analysis.
|
void |
visualizeBlockTransferInput(Block bb,
Analysis<A,S,T> analysis)
Visualize the transferInput of a Block based on the analysis.
|
void |
visualizeSpecialBlock(SpecialBlock sbb)
Visualize a SpecialBlock.
|
void |
visualizeStore(S store)
Delegate the visualization responsibility to the passed
Store instance, which will
call back to this visualizer instance for sub-components. |
void |
visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of arrays
collected by this Store. |
void |
visualizeStoreClassVals(FlowExpressions.ClassName className,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of class names
collected by this Store. |
void |
visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of fields
collected by this Store. |
void |
visualizeStoreFooter()
Called by
CFAbstractStore to visualize any information after the invocation of CFAbstractStore#internalVisualize() . |
void |
visualizeStoreHeader(String classCanonicalName)
Called by a
CFAbstractStore to visualize the class name before calling the CFAbstractStore#internalVisualize() method. |
void |
visualizeStoreKeyVal(String keyName,
Object value)
Called by
CFAbstractStore#internalVisualize() to visualize the specific information
collected according to the specific kind of Store. |
void |
visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize a local variable. |
void |
visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall,
A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of pure method
calls collected by this Store. |
void |
visualizeStoreThisVal(A value)
Called by
CFAbstractStore#internalVisualize() to visualize the value of the current
object this in this Store. |
protected String outdir
protected boolean verbose
protected String checkerName
protected StringBuilder sbDigraph
protected StringBuilder sbStore
protected StringBuilder sbBlock
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<A, S, T>)
.init
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
args
- implementation-dependent optionspublic @Nullable Map<String,Object> visualize(ControlFlowGraph cfg, Block entry, @Nullable Analysis<A,S,T> analysis)
entry
. The
concrete actions are implementation dependent.
An invocation visualize(cfg, entry, null);
does not output stores at the beginning
of basic blocks.
visualize
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
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.protected String generateDotGraph(ControlFlowGraph cfg, Block entry, @Nullable Analysis<A,S,T> analysis)
protected void generateDotNodes(Set<Block> visited, ControlFlowGraph cfg, @Nullable Analysis<A,S,T> analysis)
protected String dotOutputFileName(UnderlyingAST ast)
protected IdentityHashMap<Block,List<Integer>> getProcessOrder(ControlFlowGraph cfg)
public void visualizeBlock(Block bb, @Nullable Analysis<A,S,T> analysis)
visualizeBlock
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
bb
- basic block to visualizeanalysis
- the current analysispublic void visualizeSpecialBlock(SpecialBlock sbb)
CFGVisualizer
visualizeSpecialBlock
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
sbb
- the special blockpublic void visualizeBlockTransferInput(Block bb, Analysis<A,S,T> analysis)
CFGVisualizer
visualizeBlockTransferInput
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
bb
- the blockanalysis
- the current analysispublic void visualizeBlockNode(Node t, @Nullable Analysis<A,S,T> analysis)
CFGVisualizer
visualizeBlockNode
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
t
- the nodeanalysis
- the current analysisprotected void addDotEdge(long sId, long eId, String labelContent)
public void visualizeStore(S store)
CFGVisualizer
Store
instance, which will
call back to this visualizer instance for sub-components.visualizeStore
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
store
- the store to visualizepublic void visualizeStoreThisVal(A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of the current
object this
in this Store.visualizeStoreThisVal
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
value
- the value of the current object thispublic void visualizeStoreLocalVar(FlowExpressions.LocalVariable localVar, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize a local variable.visualizeStoreLocalVar
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
localVar
- the local variablevalue
- the value of the local variablepublic void visualizeStoreFieldVals(FlowExpressions.FieldAccess fieldAccess, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of fields
collected by this Store.visualizeStoreFieldVals
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
fieldAccess
- the fieldvalue
- the value of the fieldpublic void visualizeStoreArrayVal(FlowExpressions.ArrayAccess arrayValue, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of arrays
collected by this Store.visualizeStoreArrayVal
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
arrayValue
- the arrayvalue
- the value of the arraypublic void visualizeStoreMethodVals(FlowExpressions.MethodCall methodCall, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of pure method
calls collected by this Store.visualizeStoreMethodVals
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
methodCall
- the pure method callvalue
- the value of the pure method callpublic void visualizeStoreClassVals(FlowExpressions.ClassName className, A value)
CFGVisualizer
CFAbstractStore#internalVisualize()
to visualize the value of class names
collected by this Store.visualizeStoreClassVals
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
className
- the class namevalue
- the value of the class namepublic void 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.visualizeStoreKeyVal
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
keyName
- the name of the specific information to be visualizedvalue
- the value of the specific information to be visualizedpublic void visualizeStoreHeader(String classCanonicalName)
CFGVisualizer
CFAbstractStore
to visualize the class name before calling the CFAbstractStore#internalVisualize()
method.visualizeStoreHeader
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
classCanonicalName
- the canonical name of the classpublic void visualizeStoreFooter()
CFGVisualizer
CFAbstractStore
to visualize any information after the invocation of CFAbstractStore#internalVisualize()
.visualizeStoreFooter
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>
public void shutdown()
methods.txt
that contains a mapping from source code location to
generated dot file.shutdown
in interface CFGVisualizer<A extends AbstractValue<A>,S extends Store<S>,T extends TransferFunction<A,S>>