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

Table Of Contents
gdb-gdb-199991101/mmalloc source for the gnu memory-mapped malloc
package
The simplest way to configure and build GDB is to run configure from the
gdb-version-number source directory, which in this example is the
gdb-gdb-199991101 directory.
First switch to the gdb-version-number source directory if you are not already in it;
then run configure. Pass the identifier for the platform on which GDB will run as an
argument.
For example:
cd gdb-gdb-199991101
./configure host
make
where host is an identifier such as sun4'or decstation, that identifies the platform
where GDB will run. (You can often leave off host; configure tries to guess the correct
value by examining your system.)
Running configure host and then running make builds the `bfd', `readline',
`mmalloc', and `libiberty' libraries, then gdb itself. The configured source files, and the
binaries, are left in the corresponding source directories.
configure is a Bourne-shell (/bin/sh) script; if your system does not recognize this
automatically when you run a different shell, you may need to run sh on it explicitly:
sh configure host
If you run configure from a directory that contains source directories for multiple libraries
or programs, such as the gdb-gdb-199991101 source directory for version
gdb-199991101, configure creates configuration files for every directory level
underneath (unless you tell it not to, with the --norecursion option).
You can run the configure script from any of the subordinate directories in the GDB
distribution if you only want to configure that subdirectory, but be sure to specify a path
to it.
For example, with version gdb-199991101, type the following to configure only the
bfd subdirectory:
cd gdb-gdb-199991101/bfd
../configure host
You can install (gdb) anywhere; it has no hardwired paths. However, you should make
sure that the shell on your path (named by the SHELL environment variable) is publicly
readable. Remember that GDB uses the shell to start your program|some systems refuse
to let GDB debug child processes whose programs are not readable.
A.1 Compiling GDB in another directory
If you want to run GDB versions for several host or target machines, you need a different
gdb compiled for each combination of host and target. configure is designed to make
this easy by allowing you to generate each configuration in a separate subdirectory,
rather than in the source directory. If your make program handles the VPATH feature
A.1 Compiling GDB in another directory 363