Interface CFGVisualizer<V extends AbstractValue<V>,​S extends Store<S>,​T extends TransferFunction<V,​S>>

  • Type Parameters:
    V - the abstract value type to be tracked by the analysis
    S - the store type used in the analysis
    T - the transfer function type that is used to approximate runtime behavior
    All Known Implementing Classes:
    AbstractCFGVisualizer, DOTCFGVisualizer, StringCFGVisualizer

    public interface CFGVisualizer<V extends AbstractValue<V>,​S extends Store<S>,​T extends TransferFunction<V,​S>>
    Perform some visualization on a control flow graph. The particular operations depend on the implementation.
    • Method Detail

      • getSeparator

        java.lang.String getSeparator()
        Returns the separator for lines within a node's representation.
        Returns:
        the separator for lines within a node's representation
      • visualize

        @Nullable java.util.Map<java.lang.String,​java.lang.Object> visualize​(ControlFlowGraph cfg,
                                                                                   Block entry,
                                                                                   @Nullable Analysis<V,​S,​T> analysis)
        Creates a visualization representing the control flow graph starting at entry. The keys and values in the returned map are implementation dependent. The method should not perform any actions.

        An invocation visualize(cfg, entry, null); does not output stores at the beginning of basic blocks.

        Parameters:
        cfg - the CFG to visualize
        entry - the entry node of the control flow graph to be represented
        analysis - an analysis containing information about the program represented by the CFG. The information includes Stores that are valid at the beginning of basic blocks reachable from entry and per-node information for value producing Nodes. Can also be null to indicate that this information should not be output.
        Returns:
        visualization results, e.g. generated file names (DOTCFGVisualizer) or a String representation of the CFG (StringCFGVisualizer)
        See Also:
        visualizeWithAction(ControlFlowGraph, Block, Analysis)
      • visualizeWithAction

        @Nullable java.util.Map<java.lang.String,​java.lang.Object> visualizeWithAction​(ControlFlowGraph cfg,
                                                                                             Block entry,
                                                                                             @Nullable Analysis<V,​S,​T> analysis)
        Output a visualization representing the control flow graph starting at entry. The keys and values in the returned map are implementation dependent. The concrete actions are implementation dependent, and can include outputting information and producing files.

        An invocation visualizeWithAction(cfg, entry, null); does not output stores at the beginning of basic blocks.

        Parameters:
        cfg - the CFG to visualize
        entry - the entry node of the control flow graph to be represented
        analysis - an analysis containing information about the program represented by the CFG. The information includes Stores that are valid at the beginning of basic blocks reachable from entry and per-node information for value producing Nodes. Can also be null to indicate that this information should not be output.
        Returns:
        visualization results, e.g. generated file names (DOTCFGVisualizer) or a String representation of the CFG (StringCFGVisualizer)
        See Also:
        visualize(ControlFlowGraph, Block, Analysis)
      • visualizeStore

        java.lang.String visualizeStore​(S store)
        Delegate the visualization responsibility to the passed Store instance, which will call back to this visualizer instance for sub-components.
        Parameters:
        store - the store to visualize
        Returns:
        the String representation of the given store
      • visualizeStoreLocalVar

        java.lang.String visualizeStoreLocalVar​(LocalVariable localVar,
                                                V value)
        Called by CFAbstractStore#internalVisualize() to visualize a local variable.
        Parameters:
        localVar - the local variable
        value - the value of the local variable
        Returns:
        the String representation of the local variable
      • visualizeStoreThisVal

        java.lang.String visualizeStoreThisVal​(V value)
        Called by CFAbstractStore#internalVisualize() to visualize the value of the current object this in this Store.
        Parameters:
        value - the value of the current object this
        Returns:
        the String representation of this
      • visualizeStoreFieldVal

        java.lang.String visualizeStoreFieldVal​(FieldAccess fieldAccess,
                                                V value)
        Called by CFAbstractStore#internalVisualize() to visualize the value of one field collected by this Store.
        Parameters:
        fieldAccess - the field
        value - the value of the field
        Returns:
        the String representation of the field
      • visualizeStoreArrayVal

        java.lang.String visualizeStoreArrayVal​(ArrayAccess arrayValue,
                                                V value)
        Called by CFAbstractStore#internalVisualize() to visualize the value of one array collected by this Store.
        Parameters:
        arrayValue - the array
        value - the value of the array
        Returns:
        the String representation of the array
      • visualizeStoreMethodVals

        java.lang.String visualizeStoreMethodVals​(MethodCall methodCall,
                                                  V value)
        Called by CFAbstractStore#internalVisualize() to visualize the value of pure method calls collected by this Store.
        Parameters:
        methodCall - the pure method call
        value - the value of the pure method call
        Returns:
        the String representation of the pure method call
      • visualizeStoreClassVals

        java.lang.String visualizeStoreClassVals​(ClassName className,
                                                 V value)
        Called by CFAbstractStore#internalVisualize() to visualize the value of class names collected by this Store.
        Parameters:
        className - the class name
        value - the value of the class name
        Returns:
        the String representation of the class name
      • visualizeStoreKeyVal

        java.lang.String visualizeStoreKeyVal​(java.lang.String keyName,
                                              java.lang.Object value)
        Called by 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.
        Parameters:
        keyName - the name of the specific information to be visualized
        value - the value of the specific information to be visualized
        Returns:
        the String representation of the specific information
      • visualizeBlock

        java.lang.String visualizeBlock​(Block bb,
                                        @Nullable Analysis<V,​S,​T> analysis)
        Visualize a block based on the analysis.
        Parameters:
        bb - the block
        analysis - the current analysis
        Returns:
        the String representation of the given block
      • visualizeSpecialBlock

        java.lang.String visualizeSpecialBlock​(SpecialBlock sbb)
        Visualize a SpecialBlock.
        Parameters:
        sbb - the special block
        Returns:
        the String representation of the type of the special block sbb: entry, exit, or exceptional-exit
      • visualizeConditionalBlock

        java.lang.String visualizeConditionalBlock​(ConditionalBlock cbb)
        Visualize a ConditionalBlock.
        Parameters:
        cbb - the conditional block
        Returns:
        the String representation of the conditional block
      • visualizeBlockTransferInputBefore

        java.lang.String visualizeBlockTransferInputBefore​(Block bb,
                                                           Analysis<V,​S,​T> analysis)
        Visualize the transferInput before a Block based on the analysis.
        Parameters:
        bb - the block
        analysis - the current analysis
        Returns:
        the String representation of the transferInput before the given block
      • visualizeBlockTransferInputAfter

        java.lang.String visualizeBlockTransferInputAfter​(Block bb,
                                                          Analysis<V,​S,​T> analysis)
        Visualize the transferInput after a Block based on the analysis.
        Parameters:
        bb - the block
        analysis - the current analysis
        Returns:
        the String representation of the transferInput after the given block
      • visualizeBlockNode

        java.lang.String visualizeBlockNode​(Node t,
                                            @Nullable Analysis<V,​S,​T> analysis)
        Visualize a Node based on the analysis.
        Parameters:
        t - the node
        analysis - the current analysis
        Returns:
        the String representation of the given node
      • shutdown

        void shutdown()
        Shutdown method called once from the shutdown hook of the BaseTypeChecker.