User Tools

Site Tools


Debugging with DDD

DDD is a graphical front-end for many debuggers found on Unix systems. It will allow you to debug a program using menus and a mouse instead of having to learn the commands to use with each of the other debuggers. This document will only talk about using DDD as a front-end for gdb.

Preparing Your Program

Compilation Options

In order for your program to work with a debugger it must include debugging symbols. If you are using gcc you can make it add debugging symbols with the -g option. Since we will be using DDD as a front-end for gdb we can use the -ggdb option to get even better debugging information.


If my source code is in test.c, I would compile it like this:

gcc -o test test.c -g


gcc -o test test.c -ggdb

Using DDD

Running DDD

You can start DDD on the command line with or without the name of your program. If I wanted to debug a program called test I would run DDD like this:

ddd test


A breakpoint allows you to set a line of code as a place where the debugger will always stop. To set a breakpoint, double click on the line of code. A stop sign should appear at the beginning of the line. While using DDD you will need to set a breakpoint before running your code if you would like to step through it. I usually set it on the first line of my main function.

Running your Program

When you start DDD you should see a menu like the one to the left. Here is a description of some of the buttons:

  • Run: Start the program and run until a breakpoint or a crash.
  • Step: Step into the next line. This will step to the next line and if it is a function it will go to the first line of the function.
  • Next: Step to the next line. If the next line is a function it will run the entire function.


If you would like to see the value of a variable as a program runs, just double click on the variable name and it should appear in the upper portion of the window. You will have to click on it in a place where DDD knows about the variable (i.e. after it has been declared).

More Information

There is a lot of information available at the DDD Homepage.

debugging-with-ddd.txt · Last modified: 2017/02/02 16:24 by brysonlt