Norm Matloff's Introduction to the GVD Debugging Tool

GVD (GNU Visual Debugger) is very similar to the highly popular DDD debugging tool. As with DDD, GVD servers as a GUI front end to text-based debuggers like gdb, for languages such as C and C++. Compared to DDD, GVD is smaller and faster-loading, and has some features not found in DDD. Also,

Contents of this Web page:


It is assumed here that you are familiar with the general use of debugging tools, to set breakpoints etc. If not, see the debugging tutorial slide show at my debug Web page.

General familiarity with DDD, the debugger on which GVD was originally modeled, is helpful but not necessary.

Where to get GVD:

Download from the GVD home page. It's best to get the binary if it is available for your system.

How to install the binary:

On UNIX systems, just unpack the .tgz and run the doinstall program.

For Windows NT, just run the self-installing binary.

For Windows non-NT, you'll probably have to build the package yourself. Check the mailing list archives on the GVD home page.

Of course, make sure gvd is in your search path.

Starting it up:

Say for example your executable and source files are named lnk and Lnk.c.

Simply type

gvd lnk

Don't forget to click on Yes in the resulting popup window which asks about symbol tables.

You may wish to adjust the sizes of the panels within the window, by clicking and dragging the little squares on the boundaries between panels.

How to use the debugger:

Setting/altering breakpoints:

To set a breakpoint at a given line, click on the blue dot next to the line in the Source Window. To delete the breakpoint, click it again.

To apply other operations to breakpoints, choose Data, then Edit Breakpoints. Highlight the desired breakpoint. To disable a breakpoint, click to highlight it, and then click on the red stop sign; click again to re-enable. Setting of conditions, etc. are straightforward.

Executing, single-stepping, etc.:

Step, Next etc. work as in DDD, gdb, etc.

Checking the values of variables:

Printing the values of variables:

Moving the mouse cursor to any instance of a scalar variable within the Source Window will result in the variable's value being shown in a little box near the cursor. In the case of an array variable, the entire array is shown. In the case of an array element, say X[I], drag the mouse to highlight the array element expression, move the mouse cursor away, and finally move the cursor back to the expression again; the value will then be shown.

A pointer variable, say P, can be dereferenced by right-clicking on the variable then choosing "Print *P".

Displaying the values of variables:

Values of variables can be displayed continuously, with the displays updated as the values change. As above, right-click on the variable and then choose Display in the proper form.

Linked lists can be displayed, with links drawn to show the relations: Double-click on a pointer, and the item it points to will then be displayed.

Local variables for a function may also be displayed; choose Data then Display Local Variables.

Reloading a program after a recompile:

After recompiling a source file and re-making the executable, GVD will automatically re-load the executable but will not automatically reload the new source. The latter must be done by choosing File, then Reload Sources.


Clicking on Help will then display the manual in your Web browser.