Debugging with GDB Manual (5900-1473; WDB 6.2; January 2011)

Table Of Contents
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
information, refer to the “Supported languages” (page 98). For more information on
supported languages, refer to the “C and C++” (page 99).
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 “Fortran” (page 105).
This version of the manual documents HP WDB, implemented on HP 9000 or HP Integrity
systems running Release 11.x of the HP-UX operating system. HP 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.
14