Debugging with ddd and gdb

General Information

Several ways to debug (remove errors) from a program

ddd Debugger

If you chose to use a debugger, that tool (program) needs to be available to you, just like any other program you might use.  However, you also need to prepare the program you what to debug.  This is done with the "-g" option on the compiler.

For example:  to prepare hello.cpp for debugging, compile it with the "-g" option, e.g., "g++ -g hello.cpp"

Load the resulting executable (i.e., a.out) into the debugger when you start it up.  For example:  "ddd a.out"

Once in ddd you can

gdb Debugger

Note, ddd is built using gdb, so many of the things you can do in ddd, you can also do in gdb.  The primary difference is that ddd uses graphics and gdb does not (only text).  Therefore, gdb can be used with a terminal (text only) connection to the computer (like PuTTY).