Abstract | Program slicing is a technique for visualizing dependences and restricting attention to just the components of a program relevant to evaluation of certain expressions. Backward slicing reveals which other parts of the program the expressions' meaning depends on, while forward slicing determines which parts of the program depend on their meaning. Slicing helps programmers understand program structure, which aids program understanding, maintenance, testing, and debugging; slicing can also assist parallelization, integration and comparison of program versions, and other tasks. \par This paper improves previous techniques for static slicing. Our algorithm is expression-oriented rather than based on statements and variables, resulting in smaller slices. A user can slice on any value computed by the program –- including ones that are not, or cannot be, assigned to variables. The slicer accounts for function calls, pointers, and aggregate structures. It takes advantage of compiler analyses and transformations, resulting in more precise slices, and bypasses syntactic constraints by directly constructing executable slices. These techniques are implemented in a slicer for the C programming language that accepts input via mouse clicks; operates on the value dependence graph, a dataflow-like program representation that is especially well-suited to slicing; and displays closure slices by highlighting portions of the program in the programmer's editor. |