ROSE  0.9.9.76
dotGenerator and dotGeneratorWholeASTGraph

Overview

There are two tools to generate AST graphs in dot format. They are:

Installation

Type make install-core -j4 under $ROSE_build will build and install the tools into $ROSE_INSTALL/bin.

User Instructions

dotGeneratorWholeASTGraph provides filter options to show/hide certain AST information.

1 dotGeneratorWholeASTGraph --help
2  -rose:help show this help message
3  -rose:dotgraph:asmFileFormatFilter [0|1] Disable or enable asmFileFormat filter
4  -rose:dotgraph:asmTypeFilter [0|1] Disable or enable asmType filter
5  -rose:dotgraph:binaryExecutableFormatFilter [0|1] Disable or enable binaryExecutableFormat filter
6  -rose:dotgraph:commentAndDirectiveFilter [0|1] Disable or enable commentAndDirective filter
7  -rose:dotgraph:ctorInitializerListFilter [0|1] Disable or enable ctorInitializerList filter
8  -rose:dotgraph:defaultFilter [0|1] Disable or enable default filter
9  -rose:dotgraph:defaultColorFilter [0|1] Disable or enable defaultColor filter
10  -rose:dotgraph:edgeFilter [0|1] Disable or enable edge filter
11  -rose:dotgraph:expressionFilter [0|1] Disable or enable expression filter
12  -rose:dotgraph:fileInfoFilter [0|1] Disable or enable fileInfo filter
13  -rose:dotgraph:frontendCompatibilityFilter [0|1] Disable or enable frontendCompatibility filter
14  -rose:dotgraph:symbolFilter [0|1] Disable or enable symbol filter
15  -rose:dotgraph:emptySymbolTableFilter [0|1] Disable or enable emptySymbolTable filter
16  -rose:dotgraph:typeFilter [0|1] Disable or enable type filter
17  -rose:dotgraph:variableDeclarationFilter [0|1] Disable or enable variableDeclaration filter
18  -rose:dotgraph:variableDefinitionFilter [0|1] Disable or enable variableDefinitionFilter filter
19  -rose:dotgraph:noFilter [0|1] Disable or enable no filtering
20 Current filter flags' values are:
21  m_asmFileFormat = 0
22  m_asmType = 0
23  m_binaryExecutableFormat = 0
24  m_commentAndDirective = 1
25  m_ctorInitializer = 0
26  m_default = 1
27  m_defaultColor = 1
28  m_edge = 1
29  m_emptySymbolTable = 0
30  m_expression = 0
31  m_fileInfo = 1
32  m_frontendCompatibility = 0
33  m_symbol = 0
34  m_type = 0
35  m_variableDeclaration = 0
36  m_variableDefinition = 0
37  m_noFilter = 0

Visualization of dot files

To visualize the generated dot graph, you have to install

Please note that you have to configure ZGRViewer to have correct paths to some commands it uses. You can do it from its configuration/setting menu item. Or directly modify the text configuration file (.zgrviewer).

You have to configure the run.sh script of zgrviewer to have a correct path also

1 #!/bin/sh
2 
3 # If you want to be able to run ZGRViewer from any directory,
4 # set ZGRV_HOME to the absolute path of ZGRViewer's main directory
5 # e.g. ZGRV_HOME=/usr/local/zgrviewer
6 
7 ZGRV_HOME=/home/liao6/opt/zgrviewer-0.8.1
8 
9 java -jar $ZGRV_HOME/target/zgrviewer-0.8.1.jar "$@"

Examples

You can run the tool as follows to produce dot files:

1 dotGeneratorWholeASTGraph -c ttt.c
2 run.sh ttt.c_WholeAST.dot

Limitation

Due to the limitation of visualization tools, dotGenerator and dotGeneratorWholeASTGraph have a threshold of the max number of nodes supported. Once the threshold is reached, the tools will give up and report an error.

It is recommended to use simplest input code without including any headers to meet the requirement. Alternatively, you can use pdfGenerator to generate a pdf file for large input files.

This page is generated from $ROSE/docs/Rose/Tools/dotGenerator.dox