invariants-pointers-tr991102-20000317

invariants-pointers-tr991102-20000317 - Dynamically...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Dynamically Discovering Program Invariants Involving Collections Michael D. Ernst , William G. Griswold , Yoshio Kataoka , and David Notkin Dept. of Computer Science & Engineering University of Washington Box 352350, Seattle WA 98195-2350 USA { mernst,kataoka,notkin } @cs.washington.edu Dept. of Computer Science & Engineering University of California San Diego, 0114 La Jolla, CA 92093-0114 USA wgg@cs.ucsd.edu Abstract Explicitly stated program invariants can help programmers by characterizing aspects of program execution and identify- ing program properties that must be preserved when modi- fying code; invariants can also be of assistance to automated tools. Unfortunately, these invariants are usually absent from code. Previous work showed how to dynamically detect in- variants by looking for patterns in and relationships among variable values captured in program traces. A prototype im- plementation, Daikon, recovered invariants from formally- specified programs, and the invariants it detected assisted programmers in a software evolution task. However, it was limited to finding invariants over scalars and arrays. This paper presents two techniques that enable discovery of in- variants over richer data structures, in particular collections of data represented by recursive data structures, by indirect links through tables, etc. The first technique is to traverse these collections and record them as arrays in the program traces; then the basic Daikon invariant detector can infer in- variants over these new trace elements. The second tech- nique enables discovery of conditional invariants, which are necessary for reporting invariants over recursive data struc- tures and are also useful in their own right. These techniques permit detection of invariants such as p . value > limit or p . left mytree , The techniques are validated by success- ful application to two sets of programs: simple textbook data structures and student solutions to a weighted digraph prob- lem. 1 Introduction Previous research demonstrated the feasibility of dynami- cally detecting likely program invariants by analyzing traces of variable values [ECGN], and showed how to improve the speed of invariant detection and the usefulness of its out- put [ECGN00]. A prototype implementation, Daikon, was both accurate it reported explicitly stated invariants in for- mally specified textbook programs and useful it discov- ered, in an undocumented C program, invariants that pro- grammers found helpful in modifying the program. Daikon discovered invariants over scalars and arrays, but could not infer invariants involving richer collections of data. This pa- per extends the previous techniques to discover such invari- ants. For example, Daikon can now discover properties over collections represented using linked lists....
View Full Document

Page1 / 10

invariants-pointers-tr991102-20000317 - Dynamically...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online