The bulk of the GDB source code is in a small number of directories. Some components of GDB are libraries used elsewhere (for example BFD is used in GNU binutils), and these have their own directory. The main directories are:
include
. Header files for information which
straddles major components. For example the main simulator
interface header is here (remote-sim.h
),
because it links GDB (in directory gdb
) to
the simulators (in directory sim
). Other
headers, specific to a particular component reside in the
directory of that component.
bfd
. The Binary File Descriptor library. If a
new object file type must be recognized, it should be added here.
gdb
. The main GDB directory. All source
files should include defs.h
first and then
any other headers they reference. Headers should also include any
headers they reference, but may assume that
defs.h
has been included.
The file configure.tgt
contains a huge switch
statement to match targets specified to the main
configure command. Add a new target by
incorporating its pattern match in this file.
The sub-directory config
contains target
specific configuration information for native targets.
libiberty. Before POSIX and glibc, this was a GNU project to provide a set of standard functions. It lives on in GDB. Most valuable are its free store management and argument parsing functions.
opcodes
. This contains disassemblers for use
by GDB (the disassemble command);. In a
directory of its own, because this code is also used in
binutils.
sim
. The simulators for various targets. Each
target architecture simulator is built in its own sub-directory.