University of Leicester – Department of Computer Science

CO7206 - Fall 2003 - Lab 3: Program Analysis Using Code Surfer

24 / Oct. / 2003  

Objective: Learning to use CodeSurfer for program analysis

Skills: In the last times, students had exercises to manually comprehend some software artefacts. Manual program analysis is possible only for toy examples. For real life systems, program comprehension and reverse engineering must be aided with automated tools. This time students will learn how to use a commercial program analysis tool to get as much information as possible as fast as possible from a given C program.

Task:

1-     First you will need to set the environment variable LM_LICENSE_FILE to the value 27000@hermes.mcs.le.ac.uk in order for CodeSurfer to be able to check the license server for a valid license. You can do so by choosing startsettingscontrol panelsystemadvancedenvironment variablesnew and then writing the variable name and value.

 

2-     Next students can start CodeSurfer by choosing  startprograms CodeSurfer CodeSurfer. Students will learn CodeSurfer on their own by reading the user guide which can be invoked by pressing startprograms CodeSurfer CodeSurfer Help and which is also available online from GrammaTech Inc., via the link under resources below. Two quick overview papers that explain what CodeSurfer can do are also included in the resource list down. Note that in order to work on a subject system, you will need to open a CodeSurfer project and add the files of interest to it.

 

3-     Assignment 2: This item of the lab. is assignment number two. IT is due on Nov. 6 at noon.

·        Download the program sqrt.c

·        Crate a CodeSurfer project for it and analyze it with it

·        Print in a report the backward slice and the forward slice in the three cases (control, data and control+data dependence) for  the statement “x1 = 1/epslon”

·        Print the Chop of the program in the three cases (control, data and control+data dependence) with variable x as the source and variables x1 and x2 as the target

·        Write these results in a report with your name. – This is part one of the assignment

·        Part 2 is a 5 minutes presentation on some aspect of CodeSurfer that was not covered in the class. You will not need slides for this, but on the Lab on 6 Nov., every student will present to (after agreement with the lecturer on the subject of the presentation) for 5 minutes how CodeSurfer does (for example) pointer analysis, or cater for incomplete or missing dependence relations, etc.  You will need to investigate this and decide your topic and tell the lecturer.

 

4-     Another possible target system for your training is Indent program that was used in Lab. 2. I did not manage too get CodeSurfer to successfully build it but you can try it on your own and see if changing some CodeSurfer settings can help. This is part of the program analysis / reverse engineering task. It is not always a straight forward task.

Resources:

q      CodeSurfer Technology Overview: Dependence Graphs and Program Slicing, GrammmaTech Inc.

q       Software Inspection Using CodeSurfer, GrammmaTech Inc..

q      CodeSurfer  User Guide and Technical Reference.