Assignments

Visualization of Interprocedural Control Flow Graph of C programs

Mini-Project Proposal

Problem Statement

Graph visualization is a way of representing structural information as diagrams of abstract graphs and networks. The idea of this project is to develop a visual representation of the control flow graph of a piece of C code. The system takes as input a program written in C and produces as output a graphical representation of its control flow.
The main features of the project will be:
An Eclipse based GUI to show:

  • File System (in the left view)
  • Text Editor (in the middle view)
  • ICFG (in the right view)

Graph to statement mapping. Clicking on a graph will open the appropriate file in the text editor and highlight the statement corresponding to the node in the ICFG.

ZoomIn/Out ability for easier viewing of large graphs.

In the first stage the focus will be to implement the features for a single-file C program. But since the code of a program typically spreads over a number of files, if possible the entire structure spanning over a number of files will be shown.

Solution Design

Extraction of the ICFG of the C programs. The plan is to use available third party tools (e.g. CIL) to generate the control flow graph. If third party tool is not useful to generate ICFG then an ICFG extractor can be used, on the parse tree generated by parser generator (ANTLR, LEX-YACC). A layout algorithm will be written that will efficiently display the graph, however big it might be.

Implementation Plan

The implementation goes in the following three steps:

  1. Generation of the ICFG using either CIL or ANTLR
  2. Design and development of a layout algorithm which can appropriately visualize the ICFG, however big it is.
  3. Visualization of the graph using Eclipse graphics package - Zest The diagram below shows an example of the output from Zest.

Testing

The test cases will be C programs with 100 to 1000 lines of code. The layout will be more intuitive and easy to follow compared to the already available tools, like Graphviz. Some user survey can be done on it.

Context

The motivation for doing this project stems from static analysis of programs. Visualization of the control structure will make understanding of the code many times more easier. Many graph layout softwares are available in the market, like aiSee, but these are not available to the users free of cost. This tool can be typically used in program analysis and modified to be made compatible with other program analysis and debugging tools.