These directions on getting started with gdb on atlas are provided courtesy of Prof. Hybinette. It works the same way on odin, and the same way for C programs (compiled using gcc) as for C++ programs. -- RWR 6/8/09 ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Finding BUGS in programs: Use the debugger gdb. There is additional documentation on the web, including several tutorials linked from the "resources" sub-page of the course main page.: --------------------------------------------------------------------------- To get a quick idea what is wrong with your program, you will need to compile the program using the "-g" flag. I.e. g++ -g -c -o MainRectangle.o MainRectangle.cpp g++ -g -c -o Coordinate.o Coordinate.cpp g++ -g -c -o Rectangle.o Rectangle.cpp g++ -g -o MainRectangle MainRectangle.o Coordinate then run the debugger: {ajax:maria:245} gdb MainRectangle GNU gdb 5.0 Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.8"... (gdb) Enter the command "run": (gdb) run Starting program: /home/profs/maria/1730/ctest/unix/MainRectangle "E" Enter new coordinates. "V" View rectangle length, width, perimeter, and area. "D" Display rectangle coordinates. "I" Enter positive multiplier to shrink/grow rectangle. "Q" Quit the program. Please, select from menu above > Program exited normally. (gdb) To get help on commands select the command "help" (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. useful commands to get help on are: breakpoints running files