The ddd debugging tool is actually just a graphical X11 "front end" to gdb, so it will be assumed here that you are already familiar with gdb. (If not, see my gdb mini-manual.)

To start ddd, type

   ddd filename
where "filename" is your program's executable file. Several windows will then appear (from top to bottom):

Note that you can resize the Console window, by dragging the little square which appears at the upper-right corner.

Here is how you can execute various gdb commands conveniently via ddd:

run (r), step (s), next (n), continue (c), kill (k):

Click the left mouse button on the corresponding element in the Run window.

In the case in which your operation itself is Run, you will be prompted for command-line arguments in the Debugger Console window the first time you run the program within this ddd session.

To re-run a program within this ddd session, click the left mouse button on Program in the Control window, and then on Run Again.

If you change and save the source file and re-run the program, gdb/ddd will notice and update accordingly. However, it may not update the breakpoint positions, so check these. (If you are using the vim editor and have set autowrite, running vim's Make command will automatically save the file.)

breakpoint (b):

Click the left mouse button at the left end of the line in the Source window, and then click on Break at the top of that window.

Later, to disable a breakpoint, click on the line and then on Clear. Or, if you wish to only temporarily disable the breakpoint, click the left mouse button on Source in the Control window, then on Edit Breakpoints, then on the breakpoint in question, and then on the desired operation listed at the right of the breakpoints menu.

Often one wishes to move a breakpoint; this can be done in a very handy way in ddd by simply using the mouse to drag the stop sign to the desired line.

print (p):

To determine the current value of a variable, just move the mouse pointer to any mention of the variable in the Source window. (You do not have to click on it.)

To see the contents of a struct when you have a variable pointing to it, click the right mouse button on any mention of the pointer, and select "*Print()" in the resulting pull-down menu.

display (disp):

To have a variable's value displayed continuously, click on it in the Source window and then click the Display icon.

You can click the right mouse button as with "print" above, to continuously display the contents of a struct.

To delete a display, click on it and then click Undisplay.

backtrace (bt):

Click on Status in the Control window, then Backtrace. A Backtrace window will pop up, and will continue to show you the current call stack as you step through the program.

This is especially useful when debugging threads-based programs.

quit (q):
Choose File in the Control window, then Exit.

Here are some tips for using ddd to debug threads-based programs. First, make sure to have a Backtrace window, as discussed earlier. Second, have a Threads window (click on Status, then Threads). The latter highlights whichever thread is currently active; clicking on another thread will make that one active, and the Backtrace window will be updated accordingly.