Query-Based Debugging


Raimondas Lencevicius 
Abstract: Object relationships in modern software systems are becoming increasingly numerous and complex. Program errors due to violations of object relationships are hard to find because of the cause-effect gap between the time when an error occurs and the time when the error becomes apparent to the programmer. Although debugging techniques such as conditional and data breakpoints help to find error causes in simple cases, they fail to effectively bridge the cause-effect gap in many situations. Programmers need new tools that allow them to explore objects in a large system more efficiently and to detect broken object relationships instantaneously.

Many existing debuggers present only a low-level, one-object-at-a-time view of objects and their relationships. We propose a new solution to overcome these problems: query-based debugging. The implementation of the query-based debugger described here offers programmers an effective query tool that allows efficient searching of large object spaces and quick verification of complex relationships. Even for programs that have large numbers of objects, the debugger achieves interactive response times for common queries by using a combination of fast searching primitives, query optimization, and incremental result delivery.

Dynamic query-based debuggers extend query-based debugging by providing instant error alerts. In other words, they continuously check inter-object relationships while the debugged program is running. To speed up dynamic query evaluation, our debugger (implemented in portable Java) uses a combination of program instrumentation, load-time code generation, query optimization, and incremental reevaluation. Experiments and a query cost model show that selection queries are efficient in most cases, while more costly join queries are practical when query evaluations are infrequent or query domains are small.

We thus demonstrate that query-based debugging is a useful method that can be efficiently implemented and effectively used in program debugging.

Keywords: Debugging, Breakpoints, Java, Queries, Class Loaders, Instrumentation


Technical Report TRCS99-27, Ph.D. Thesis, Computer Science Department, University of California, Santa Barbara, August 1999.

To get the PostScript file, click here (PDF is here).