Last updated: Tue Nov 14 03:10:28 CST 2000
The remainder of this document gives an overview of the system
and describes some of its capabilities.
For your convenience, the system's reference manual can be obtained
by clicking
here.
Some of the technical papers that describe the system's theoretical
underpinnings include
[FOW87, HR92,
HRB90, RHSR94,
B93].
The home page of the
Wisconsin Program-Slicing Project is a source of additional
information about program slicing and other related research that has
been carried out at Wisconsin.
For surveys of research on program slicing and its applications,
see [T95] and [BG96].
The original paper on program slicing is [W84].
System Capabilities
The heart of the Wisconsin Program-Slicing Tool is a package for
manipulating program dependence graphs (PDGs)
[KKLPW81, FOW87,
HPR89]
and an extension of program dependence graphs, called
system dependence graphs (SDGs), which are
a variant of PDGs extended to handle multiple procedures
[HRB90, RHSR94].
From the user's perspective, the Slicing Tool's main capabilities are:
We will illustrate backward slicing using the following program as an example:
When a backward slice of this program is performed with respect to variable i in the printf statement in function demo (i.e., with respect to the position of the caret six lines from the bottom), the results are displayed as follows:
This example illustrates the application of the Slicing Tool to a program that contains C-preprocessor directives (i.e., ``#include'', ``#ifdef'', ``#else'', etc.). In general, a ``.c'' file does not contain a C program; rather, it contains text that can be preprocessed to produce a C program. For this reason, when the SDG for a program is constructed, the user is presented with a dialog box in which to provide the appropriate C-preprocessor flags (``-I'', ``-D'', etc.) and their arguments (e.g., ``-I.'', ``-DEVEN'', etc.). The SDG constructed is specific to the C program that results from preprocessing the source files with respect to these flags. In the example above, we supplied the flag ``-DEVEN'', which is why the line
The Slicing Tool can operate on complete or partial C programs;
assumptions made about incomplete programs are discussed
below.
Versions of the Slicing Tool
There are two versions of the Wisconsin Program-Slicing Tool: an
interactive version, which allows a user to invoke various
operations and view the results; and a batch version, which
can be used to report statistics about a program, or to build and save
the program's SDG, which can be used later by either the interactive
or batch versions of the tool.
Once a program's SDG has been created, subsequent operations of the
Slicing Tool can be carried out much faster.
(For your convenience, the man page for the batch version of the
Slicing Tool can be obtained by clicking
here.)
In the interactive version of the Slicing Tool, there is a a language-specific browser created using the Synthesizer Generator, a meta-system for creating interactive, language-based program-development systems [RT88a, RT88b]. Commands are provided to build or use an SDG to perform various actions. The Synthesizer Generator's facility for displaying program components in different display styles is used to report information back to the user of the Slicing Tool. The various commands use different colors and/or different typefaces (depending on how the display styles are defined in the X resources file for the editor) to indicate various collections of program components. For example, as above, the components in a slice of a program are ordinarily highlighted by displaying them in a contrasting display style.
For both the interactive and batch versions of the Slicing Tool, there are three possible configurations. The different configurations are distinguished by the following features:
The decision as to which configuration to use should be made according to the size of the program that will be operated on, as well as the operations that will be performed on the program: The different configurations differ in terms of how large a program they can handle and how quickly the various operations are performed. The best performance in terms of run time is obtained with the compressed version. The io version is slower due to the I/O operations it performs, but it does not require as much main memory as the other two configurations.
The Slicing Tool has been used successfully to slice systems as large
as 51,000 lines.
Some statistics on the performance of the Slicing Tool for programs
ranging in size from approximately 1,000-30,000 lines can be found in
the
Wisconsin Program-Slicing Tool Reference Manual.
Assumptions and Limitations
Source files are assumed to contain syntactically correct C code.
To allow different parts of SDGs to be built during different sessions
(in a manner similar to separate compilation), no main procedure is
required.
It is an error to have more than one non-static function with a given name. Functions not found in the program or libraries are handled as follows: We make the optimistic (non-conservative) assumption that they do not use or modify global variables and do not dereference pointer variables; we then make the conservative assumption that at all calls to such functions all possible dependences exist, and thus insert all possible summary edges (i.e., edges between parameter-in and parameter-out vertices) into the SDG.
Pointers are handled as follows:
In the current version of the Slicing Tool, a few limitations on programs are imposed by the C front end. Some of the features that it does not currently handle are
typedef int foo; struct { int foo; };
int x = sizeof(int) == 4 ? 0 : 1;
The Wisconsin Program-Slicing Tool consists of the following components:
The C front end itself consists of two components:
Because the C front end operates on a single file at a time, there is essentially no limitation on the size of programs that it can process (as long as each individual file is of reasonable size).
A first pass through the intermediate files produced by the front end builds the call graph and gathers information about global variables and indirect calls (calls via pointers) in the program. A second pass builds a control flow graph for each procedure.
The program's procedure dependence graphs are constructed from their corresponding control flow graphs. The SDG proper is then constructed by linking together all of the program's procedure dependence graphs with call-graph information and introducing some additional information that summarizes transitive dependences due to procedure calls [HRB90, RHSR94].
The SDG of a given program can be written to a file for later use.
Platforms Supported
The Wisconsin Program-Slicing Tool has been developed and tested
on Sun SPARCstations running SunOS 5.5.1 (also known as Solaris 2.5.1),
compiled with gcc, version 2.7.2.1.
The Slicing Tool's browser uses X11R6.
We have not compiled or tested the system on versions of UNIX other
than SunOS 5.5.1.
The Synthesizer Generator runs on SPARC Solaris 2.x, SunOS 4.1.x, AIX 4.x,
HP-UX 10, Intel Solaris 2.5, Digital UNIX, IRIX 6.2, and porting
the Slicing Tool to these platforms should be relatively straightforward.
Licensing Requirements
Although the Wisconsin Program-Slicing Tool
was distributed from 1996-2000 for not-for-profit
research purposes under license from the University of Wisconsin,
it is no longer being distributed.
However, there is a commercial tool available, named
Codsurfer, that is derived from the
Wisconsin implementation and is available from
GrammaTech, Inc.
GrammaTech has improved on the Wisconsin implementation considerably
(both in terms of speed and space efficiency).
GrammaTech also provides CodeSurfer to academic researchers on very
favorable terms.
CodeSurfer builds a dependence-graph program representation and provides a GUI for exploring this web. The dependence graph includes forward and backward links between each assignment statement and possible uses of the values stored by that assignment. Pointer analysis is used so that indirect loads and stores through pointers are taken into account, as well as indirect function calls. Dataflow analysis is used so that links between unrelated assignments and uses are excluded. Operations that highlight forward and backward slices show the impact of a given statement on the rest of the program (forward slicing), and the impact of the rest of a program on a given statement (backward slicing) [TOPLAS90, FSE94]. Operations that highlight paths between nodes in the dependence graph (chops) show ways in which the program points are interdependent (or independent) [FSE95b]. CodeSurfer's scripting language, which provides access to the dependence-graph program representation and the Tk widget set, is used for extensibility and for batch applications.
Full information about CodeSurfer is available here, where you can find