Visual debugging

Visual debugging

Visualization of computer program state and program execution to facilitate understanding and, if necessary, alteration of the program. Debuggers are universal tools for understanding what is going on when a program is executed. Using a debugger, one can execute the program in a specific environment, stop the program under specific conditions, and examine or alter the content of the program variables or pointers. Traditional command-line oriented debuggers allowed only a simple textual representation of the program variables (program state).

Textual representation did not change even when modern debuggers came with a graphical user interface. Although variable names became accessible by means of menus, the variable values were still presented as text, including structural information, such as pointers and references. Likewise, the program execution is available only as a series of isolated program stops. (Pointers are variables that contain the “addresses” of other variables.) Compared to traditional debuggers, the techniques of visual debugging allow quicker exploration and understanding of what is going on in a program. See Computer programming, Programming languages, Software, Software engineering

The GNU Data Display Debugger (DDD), for example, is a graphical front-end to a command-line debugger, providing menus and other graphical interfaces that eventually translate into debugger commands. As a unique feature, DDD allows the visualization of data structures as graphs. The concept is simple: Double-clicking on a variable shows its value as an isolated graph node. By double-clicking on a pointer, the dereferenced value or the variable pointed is to shown as another graph node, with an edge relating pointer and dereferenced value. By subsequent double-clicking on pointers, the programmer can unfold the entire data structure.

If a pointer points to a value that is already displayed (for example, in a circular list), no new node is created; instead, the edge is drawn to the existing value. Using this alias recognition, the programmer can quickly identify data structures that are referenced by multiple pointers.

In principle, DDD can render arbitrary data structures by means of nodes and edges. However, the programmer must choose what to unfold, as the screen size quickly limits the number of variables displayed. Nonetheless, DDD is one of the most popular debugging tools under Unix and Linux.