Abstract.To understand the dynamics of a running program, it is often useful to examine its state at specific moments during its execution. We present memory graphs as a means to capture and explore program states. A memory graph gives a comprehensive view of all data structures of a program; data items are related by operations like dereferencing, indexing or member access. Although memory graphs are typically too large to be visualized as a whole, one can easily focus on specific aspects using well-known graph operations. For instance, a greatest common subgraph visualizes commonalities and differences between program states. Keywords: program understanding, debugging aids, diagnostics, data types and structures, graphs
A Structured View of MemoryExploring the state of a program, to view its variables, values, and current execution position, is a typical task in debugging programs. Today's interactive debuggers allow accessing the values of arbitrary variables and printing their values. Typically, values are shown as texts. Here's an example output from the GNU debugger GDB:(gdb) print *tree *tree = {value = 7, name = 0x8049e88 "Ada", left = 0x804d7d8, right = 0x0, left thread = false, right thread = false, date = {day of week = Thu, day = 1, month = 1, year = 1970, vptr. = 0x8049f78 Date virtual table }, static shared = 4711} (gdb) _ Fig. 1. Printing textual data with GDB Although modern debuggers offer graphical user interfaces instead of GDB's command line, data values are still shown as text. This is useful in the most cases, but fails badly as soon as references and pointers come into play. Consider Figure 1, for example: where does tree-> left point to? Of course, one can simply print the dereferenced value. However, a user will never notice if two pointers point to the same address-except by thoroughly checking and comparing pointer values.