Griffin-TG it's a tool that allows its users to run isolated functions in C automatically. The kind of function accepted by the tool are the ones that receive arrays by parameters. The main goal of the tool is to generate data to execute the target function that don't lead to a bad memory access. By a bad memory access, we mean an access out of the limits of the memory allocated to the array. Considering the goal stated before, this is made with random generated inputs that are passed to the function trough its parameters. This tool can be used together with other programs for dynamically analyse functions written in C.
- Cmake
- C++14 compiler
- xdot
- valgrind (optional: if you want to check that the function will run without memory errors caused by bad memory access.)
cd src
cmake CMakeLists.txt
make
- the target file must be in the folder "griffin-TG/src/stubTests/";
- in the folder "griffin-TG/src/" there is a script, "testFile.sh", that can be used to run the tool for the target function, ex.: "./testFile.sh stubTests/targetFile.c"
- there are some examples of inputs to the griffin-TG in the folders in "griffin-TG/src/stubTests/tests/". To try them, you need just to copy them to the folder "griffin-TG/src/stubTests/" and use the script "griffin-TG/src/testFile.sh" in each file that you want;
We performed the experiments in a machine with Ubuntu 16.04 LTS (kernel 4.15.0-36-generic).
The output of the tool is a main file that is able to execute the function passed as parameter without causing errors related to bad memory access. Once the tool is used, this main file can be found in "griffin-TG/src/stubTests/mains/". Besides the previous file, the tool creates the following files in the process:
- griffin-TG/src/initGraph.dot: debug information showing the order of the declarations of each used variable used to build the main file;
- griffin-TG/src/stubTests/*.dot: debug information about the way as the arrays are accessed and how the information flows during the process of finding the input data to the file;
- griffin-TG/src/stubTests/graphs/*.pdf: same information as in the item before, 2), but the files in this folder are images in pdf;
- we analyze access made by the syntax '[]', eg: "v [a + 1]";
- the tool can analyze only one function in plain C (no macros);
- the code given as input to the tool must be something compilable;
- the current state of Griffin-TG can not handle structs;
- in loops, avoid using subtraction or operations that lead to expression with negative coefficients;
- variables used to guide the loop should be declared before the 'for' or 'while' statement.
This is a research project. While we strive to keep the code clean and to make the tool easily accessible, this is an academic effort. Neverless, feel free to provide feedback or to report bugs.
Marcus Rodrigues de Araújo ([email protected])