Tracking bad apples: reporting the origin of null and undefined value errors

  • Authors:
  • Michael D. Bond;Nicholas Nethercote;Stephen W. Kent;Samuel Z. Guyer;Kathryn S. McKinley

  • Affiliations:
  • University of Texas at Austin, Austin, TX;National ICT Australia, Melbourne, Australia;University of Texas at Austin, Austin, TX;Tufts University, Boston, MA;University of Texas at Austin, Austin, TX

  • Venue:
  • Proceedings of the 22nd annual ACM SIGPLAN conference on Object-oriented programming systems and applications
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

Programs sometimes crash due to unusable values, for example, when Java and C# programs dereference null pointers and when C and C++ programs use undefined values to affect program behavior. A stack trace produced on such a crash identifies the effect of the unusable value, not its cause, and is often not much help to the programmer. This paper presents efficient origin tracking of unusable values; it shows how to record where these values come into existence, correctly propagate them, and report them if they cause an error. The key idea is value piggybacking: when the original program stores an unusable value, value piggybacking instead stores origin information in the spare bits of the unusable value. Modest compiler support alters the program to propagate these modified values through operations such as assignments and comparisons. We evaluate two implementations: the first tracks null pointer origins in a JVM, and the second tracks undefined value origins in a memory-checking tool built with Valgrind. These implementations show that origin tracking via value piggybacking is fast and often useful, and in the Java case, has low enough overhead for use in a production environment.