Linux C++ Debug
|
We have the kdbg and ddd debuggers installed. They are both a
graphic front end for the gdb, the GNU debugger. This means that they are not
the actual debugger. Instead, they communicate with gdb, a command line
debugger, by sending it commands, and displaying its output.
|
kdbg is part of the KDE desktop, but it
can also be run from the Gnome desktop.
|
| 1. |
Compile your program with debug information, and give it a name. |
|
g++ -g -o filename filename.cc |
| 2. |
Start debug program. Include execution name of program on command
line. |
| |
kdbg filename |
| 3. |
Click left of a + sign to create a break point. This shows as a stop
sign. |
| 4. |
Press F5 key to run to break point. |
| 5. |
You can now single stop or run to another break point. See top menus
for details. |
| 6. |
Hold mouse cursor over a variable to see its value. |
| 7. |
For more information see:
http://members.nextra.at/johsixt/kdbg.html |
|
|
|
ddd is much more complex. User settings
are extensive and program operation is less intuitive. It comes with a small
sample session that explains the basics in a short time.
|
| 1. |
Compile your program with debug information, and give it a name. |
|
g++ -g -o filename filename.cc |
| 2. |
Start debug program. Include execution name of program on command
line. |
| . |
ddd filename |
| 3. |
Click in the left most column the click the stop sign in the top menu
bar. |
| |
This creates a break point and puts small stop sign in the left
column. |
| 4. |
Click on run in right menu to run to break point. |
| 5. |
You can now single stop or run to another break point. See right
menus for details. |
| 6. |
Hold mouse cursor over a variable to see its value. |
| 7. |
For more information see:
http://www.gnu.org/manual/ddd/html_mono/ddd.html#Sample%20session |
|
| Return to Computer
Laboratory Page |