Debugging with GDB (February 2008)

Table Of Contents
Summary of GDB 1
Summary of GDB
The purpose of a debugger such as GDB is to allow you to see what is going on “inside”
another program while it executes—or what another program was doing at the moment it
crashed.
GDB allows you to do the following:
Load the executable along with any required arguments.
Stop your program on specified blocks of code.
Examine your program when it has stopped running due to an error.
Change things in your program, so you can experiment with correcting the effects of
one bug and go on to learn about another.
You can use GDB to debug programs written in C, C++ and Fortran. For more infor-
mation, refer to the Section 9.4 [Supported languages], page 83. For more information on
supported languages, refer to the Section 9.4.1 [C and C++], page 84.
GDB can be used to debug programs written in Fortran, although it may be necessary
to refer to some variables with a trailing underscore. See Section 9.4.2 [Fortran], page 90.
This version of the manual documents WDB, implemented on HP 9000 or HP Integrity
systems running Release 11.x of the HP-UX operating system. WDB can be used to debug
code generated by the HP ANSI C, HP ANSI aC++ and HP Fortran compilers as well as
the gnu C and C++ compilers. It does not support the debugging of Pascal, Modula-2 or
Chill programs.
Free software
GDB is free software, protected by the gnu General Public License (GPL). The GPL
gives you the freedom to copy or adapt a licensed program—but every person getting a
copy also gets with it the freedom to modify that copy (which means that they must get
access to the source code), and the freedom to distribute further copies. Typical software
companies use copyrights to limit your freedoms; the Free Software Foundation uses the
GPL to preserve these freedoms.
Fundamentally, the General Public License is a license which says that you have these
freedoms and that you cannot take these freedoms away from anyone else.
Contributors to GDB
Richard Stallman was the original author of GDB, and of many other gnu programs.
Many others have contributed to its development. This section attempts to credit major
contributors. One of the virtues of free software is that everyone is free to contribute to
it; with regret, we cannot actually acknowledge everyone here. The file ChangeLog in the
GDB distribution approximates a blow-by-blow account.
Changes much prior to version 2.0 are lost in the mists of time.
Plea: Additions to this section are particularly welcome. If you or your friends
(or enemies, to be evenhanded) have been unfairly omitted from this list, we
would like to add your names!