Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
How does it work? | ||||||||
Changed: | ||||||||
< < | ![]() | |||||||
> > | ![]() ![]() | |||||||
The process starts with C, Python and JavaScript source code from which separate ASTs (Abstract Syntax Tree) are dumped using Clang-Check (for C files) | ||||||||
Line: 12 to 14 | ||||||||
Figure 1: Portion of a C AST file | ||||||||
Changed: | ||||||||
< < | the AST module and the file ast2json.py (for Python files), | |||||||
> > | the AST module and the file ast2json.py![]() | |||||||
![]() | ||||||||
Changed: | ||||||||
< < | And SpiderMonkey for JavaScript files. | |||||||
> > | And SpiderMonkey![]() | |||||||
![]() | ||||||||
Changed: | ||||||||
< < | The AST files have very different structures for C and Python, but the parsers are designed to handle each kind of AST differently. Those parsers filter the AST files detecting and recording function calls and their arguments. Initially, the program is capable of detecting literals and variables as arguments. Reaching Definition Analysis will be developed in the future in order to handle statically assigned variables as arguments to functions. The current version of the program handles part of the Python.h interface between C and Python. It only analyzes “PyRun_SimpleFile” calls. Other mechanisms for calling Python from C will also be implemented in the future. When a call to “PyRun_SimpleFile” is found, its argument (name of the python file) is considered a function call and the executable portion of that python file is represented as the main function in C. That creates the connection between the C and the Python files, which allows the subsequent programs to build the call graph. | |||||||
> > | The AST files have very different structures for C, Python and Javascript, but the parsers are designed to handle each kind of AST differently. Those parsers filter the AST files, detecting and recording function calls and their arguments. Initially, the program is capable of detecting literals and variables as arguments. Reaching Definition Analysis will be developed in the future in order to handle statically assigned variables as arguments to functions. The current version of the program handles part of the Python.h interface between C and Python. It only analyzes “PyRun_SimpleFile” calls. Other mechanisms for calling Python from C will also be implemented in the future. The version can also handle PyV8's eval function to call a JavaScript program from Python. In the future, the program will be able to handle cases in which a JavaScript program is called from a C program, and both JavaScript and Python functions are called from C programs. | |||||||
Changed: | ||||||||
< < | “CombineCSV.py” combines all individual csv files from the list of source files into one. This file is then used as input to “GenerateDot.py”. This program translates the csv file to a dot file, which represents the csv file as a graph. The Dot program builds the final graph and saves it as a PDF file. Circular nodes represent C functions and Rectangular nodes represent Python functions. | |||||||
> > | When the designated function used to call another program of another language, such as “PyRun_SimpleFile” or JSContext().eval(), is found, its argument (name of the Python or JavaScript file) is considered a function call and the executable portion of that file is represented as the main function in the original program. That creates the connection between the two files, which allows the subsequent programs to build the call graph. “CombineCSV.py” combines all individual csv files from the list of source files into one. This file is then used as input to “GenerateDot.py”. This program translates the csv file to a dot file, which represents the csv file as a graph. The Dot program builds the final graph via GraphViz and saves it as a PDF file. Circular nodes represent C programs, rectangular nodes represent Python programs, and hexagonal nodes represent JavaScript programs. Recursive functions are denoted by dotted nodes. | |||||||
![]() | ||||||||
Line: 48 to 48 | ||||||||
| ||||||||
Added: | ||||||||
> > |
|