ddd is a GUI written atop gdb, but sometimes less tedious to use. gdb is a mostly command line-oriented debugger that is more stable than ddd.
For tutorials, see
b main; step to main step where single-step to where
ddd has peculiarities. It grows unstable sometimes, especially in the command line window where beyond a point, you will no longer be able to enter gdb commands. I haven’t experimented carefully for this, but my impression is that at least a restart is needed, often a reboot. (Yeah, I’m having a hard time with that one too, but simply restarting doesn’t always fix the problem.)
As near as I can tell, there is no documentation or support for ddd. There are a few useful tutorials on gdb including on how to use it to debug curses programs. I have tried this, but even following the tutorials closely, debugging curses programs sucks rocks in gdb. For most problems, printf works much better.
On the surface, ddd comes close to being a useful source-level debugger. It’s main virtue is to remove console noise and confusion from gdb in the way source code and watched variables are display. It is also simpler and more visually oriented to use in setting simple breakpoints.
ddd also suffers from less-than-reliable source code listing, something it shares with gdb.
To wit: upon arriving at a breakpoint, it doesn’t always know where it is and like the sonar analysis software on FBM Dallas of Tom Clancy fame, almost consistently “runs home to mama” in that it will list your main function source code instead. But, if you step to the next statement in the code using n, this clears itself. I usually set my breakpoints one instruction ahead if using s or n will take me past where I wanted to be.
gdb is more stable and more useful than ddd when it comes to tracking down failure points for which the program needs to be stopped, restarted and break-pointed in a slowly incrementing point as you edge up on the problem. I find it better when attempting to run, find things bad, record where, start over and run again, but this might be one narrow type of problem. I haven’t had much experience using gdb and my days of dbx go back nearly 20 years.
Use .gdbinit in local directory to implement preparatory commands.
Use TAB to complete command.
Press RETURN to repeat last command.
Other format specifiers include: decimal, unsigned, octal, two (binary), address, character (prints as both character and its decimal value), and floating point.
When ddd is launched, sometimes the environment isn’t cooperative. There are things to do to solve this and I don’t grok the whole situation well enough to speak intelligently about it, so do these things:
export DISPLAY=:0.0
User_Alias X_USERS = russ[, someone-else, etc.] . . . Defaults:X_USERS env_keep += DISPLAY Defaults:X_USERS env_keep += XAUTHORITY
if [ -f ${HOME}/.bashrc ]; then . ${HOME}/.bashrc fi
Also, xhost, used to add or delete host or user names to the list of those allowed to make connections to the X server, is meaningful: the user running must be granted this privilege:
russ@taliesin:~> xhost +russ taliesin:~> xhost +localhost