Class CFGVisualizeLauncher
java.lang.Object
org.checkerframework.dataflow.cfg.visualize.CFGVisualizeLauncher
Launcher to generate the DOT or String representation of the control flow graph of a given method
in a given class.
Usage: Directly run it as the main class to generate the DOT representation of the control
flow graph of a given method in a given class. See ConstantPropagationPlayground
for another way to
use it.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<V extends AbstractValue<V>,
S extends Store<S>, T extends TransferFunction<V, S>>
voidgenerateDOTofCFG
(String inputFile, String outputDir, String method, String clas, boolean pdf, boolean verbose, @Nullable Analysis<V, S, T> analysis) Generate the DOT representation of the CFG for a method.protected void
generateDOTofCFGWithoutAnalysis
(String inputFile, String outputDir, String method, String clas, boolean pdf, boolean verbose) Generate the DOT representation of the CFG for a method, only.protected ControlFlowGraph
generateMethodCFG
(String file, String clas, String method) Generate the control flow graph of a method in a class.<V extends AbstractValue<V>,
S extends Store<S>, T extends TransferFunction<V, S>>
@Nullable Map<String,Object> generateStringOfCFG
(String inputFile, String method, String clas, boolean verbose, @Nullable Analysis<V, S, T> analysis) Generate the String representation of the CFG for a method.protected String
generateStringOfCFGWithoutAnalysis
(String inputFile, String method, String clas, boolean verbose) Generate the String representation of the CFG for a method, only.static void
The main entry point of CFGVisualizeLauncher.protected void
printError
(@Nullable String string) Print error message.protected void
Print usage information.protected void
producePDF
(String file) Invoke "dot" command to generate a PDF.
-
Constructor Details
-
CFGVisualizeLauncher
public CFGVisualizeLauncher()
-
-
Method Details
-
main
The main entry point of CFGVisualizeLauncher.- Parameters:
args
- the passed arguments, seeprintUsage()
for the usage
-
generateDOTofCFGWithoutAnalysis
protected void generateDOTofCFGWithoutAnalysis(String inputFile, String outputDir, String method, String clas, boolean pdf, boolean verbose) Generate the DOT representation of the CFG for a method, only. Does no dataflow analysis.- Parameters:
inputFile
- a Java source file, used as inputoutputDir
- output directorymethod
- name of the method to generate the CFG forclas
- name of the class which includes the method to generate the CFG forpdf
- also generate a PDFverbose
- show verbose information in CFG
-
generateStringOfCFGWithoutAnalysis
protected String generateStringOfCFGWithoutAnalysis(String inputFile, String method, String clas, boolean verbose) Generate the String representation of the CFG for a method, only. Does no dataflow analysis.- Parameters:
inputFile
- a Java source file, used as inputmethod
- name of the method to generate the CFG forclas
- name of the class which includes the method to generate the CFG forverbose
- show verbose information in CFG- Returns:
- the String representation of the CFG
-
generateDOTofCFG
public <V extends AbstractValue<V>,S extends Store<S>, void generateDOTofCFGT extends TransferFunction<V, S>> (String inputFile, String outputDir, String method, String clas, boolean pdf, boolean verbose, @Nullable Analysis<V, S, T> analysis) Generate the DOT representation of the CFG for a method.- Type Parameters:
V
- the abstract value type to be tracked by the analysisS
- the store type used in the analysisT
- the transfer function type that is used to approximated runtime behavior- Parameters:
inputFile
- a Java source file, used as inputoutputDir
- source output directorymethod
- name of the method to generate the CFG forclas
- name of the class which includes the method to generate the CFG forpdf
- also generate a PDFverbose
- show verbose information in CFGanalysis
- analysis to perform before the visualization (ornull
if no analysis is to be performed)
-
generateMethodCFG
Generate the control flow graph of a method in a class.- Parameters:
file
- a Java source file, used as inputclas
- name of the class which includes the method to generate the CFG formethod
- name of the method to generate the CFG for- Returns:
- control flow graph of the specified method
-
producePDF
Invoke "dot" command to generate a PDF.- Parameters:
file
- name of the dot file
-
generateStringOfCFG
public <V extends AbstractValue<V>,S extends Store<S>, @Nullable Map<String,T extends TransferFunction<V, S>> Object> generateStringOfCFG(String inputFile, String method, String clas, boolean verbose, @Nullable Analysis<V, S, T> analysis) Generate the String representation of the CFG for a method.- Type Parameters:
V
- the abstract value type to be tracked by the analysisS
- the store type used in the analysisT
- the transfer function type that is used to approximated runtime behavior- Parameters:
inputFile
- a Java source file, used as inputmethod
- name of the method to generate the CFG forclas
- name of the class which includes the method to generate the CFG forverbose
- show verbose information in CFGanalysis
- analysis to perform before the visualization (ornull
if no analysis is to be performed)- Returns:
- a map which includes a key "stringGraph" and the String representation of CFG as the value
-
printUsage
protected void printUsage()Print usage information. -
printError
Print error message.- Parameters:
string
- error message
-