Debugging with GDB Manual HP WDB v6.3 (5900-2180, August 2012)

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 80). For more information on supported languages, refer to
the “C and C++” (page 80).
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 85).
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.
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!
So that they may not regard their many labors as thankless, we particularly thank those who
shepherded GDB through major releases: Andrew Cagney (release 5.0); Jim Blandy (release 4.18);
Jason Molenda (release 4.17); Stan Shebs (release 4.14); Fred Fish (releases 4.16, 4.15, 4.13,
4.12, 4.11, 4.10, and 4.9); Stu Grossman and John Gilmore (releases 4.8, 4.7, 4.6, 4.5, and
4.4); John Gilmore (releases 4.3, 4.2, 4.1, 4.0, and 3.9); Jim Kingdon (releases 3.5, 3.4, and
3.3); and Randy Smith (releases 3.2, 3.1, and 3.0).
Richard Stallman, assisted at various times by Peter TerMaat, Chris Hanson, and Richard Mlynarik,
handled releases through 2.8.
Free Software 13