Demonstrations

16 Using Events to Debug Java Programs Backwards in Time

Tuesday, 28 October – 16:00-16:45

Thursday, 30 October – 11:00-11:45

Bil Lewis, Lambda Computer Science, Bil.Lewis@LambdaCS.com
Mireille Ducassé, IRISA, ducasse@irisa.fr

An "Omniscient Debugger" works by recording all state changes in the run of a program, and then allowing the programmer to explore the history of that program— effectively going "backwards in time." Event analysis debuggers work by observing events as they occur, and allowing the programmer to write queries which will pause the program when matched.

Recently we have integrated the two techniques to produce an omniscient debugger which can use event queries to search the history of a program interactively. The query mechanism is designed along the lines of an EMACS incremental search.

The implementation of the system is in Java and records two types of events: method calls (and returns) and assignments. To our best knowledge, this is the first event model for Java.

A typical scenario is a quick sort program which neglects to sort one entry. An event search for the method call which should have sorted the entry ("Find a call to sort() whose start is less than the entry and whose end is greater") allows the programmer to get close to the bug, and the normal mechanisms of the omniscient debugger ("step forwards", "step backwards", etc.) allow the programmer to verify the exact cause of the bug.

In addition to the above (which the Prolog-based Coca system of Ducasse is capable of), it is possible to include both objects and the instance variables of those objects in the query (e.g., "Find a call to OBJ.sort() where OBJ.type is 'Integer'").