3 This is GDB, the GNU source-level debugger.
5 A summary of new features is in the file `gdb/NEWS'.
7 Check the GDB home page at http://www.gnu.org/software/gdb/ for up to
8 date release information, mailing list links and archives, etc.
10 The file `gdb/PROBLEMS' contains information on problems identified
11 late in the release cycle. GDB's bug tracking data base at
12 http://www.gnu.org/software/gdb/bugs/ contains a more complete list of
16 Unpacking and Installation -- quick overview
17 ==========================
19 The release is provided as a gzipped tar file called
20 'gdb-VERSION.tar.gz', where VERSION is the version of GDB.
22 The GDB debugger sources, the generic GNU include
23 files, the BFD ("binary file description") library, the readline
24 library, and other libraries all have directories of their own
25 underneath the gdb-VERSION directory. The idea is that a variety of GNU
26 tools can share a common copy of these things. Be aware of variation
27 over time--for example don't try to build GDB with a copy of bfd from
28 a release other than the GDB release (such as a binutils release),
29 especially if the releases are more than a few weeks apart.
30 Configuration scripts and makefiles exist to cruise up and down this
31 directory tree and automatically build all the pieces in the right
34 When you unpack the gdb-VERSION.tar.gz file, it will create a
35 source directory called `gdb-VERSION'.
37 You can build GDB right in the source directory:
42 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
44 However, we recommend that an empty directory be used instead.
45 This way you do not clutter your source tree with binary files
46 and will be able to create different builds with different
47 configuration options.
49 You can build GDB in any empty build directory:
53 <full path to your sources>/gdb-VERSION/configure
55 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
57 (Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
58 different; see the file gdb-VERSION/gdb/config/djgpp/README for details.)
60 This will configure and build all the libraries as well as GDB. If
61 `configure' can't determine your system type, specify one as its
62 argument, e.g., `./configure sun4' or `./configure decstation'.
64 Make sure that your 'configure' line ends in 'gdb-VERSION/configure':
66 /berman/migchain/source/gdb-VERSION/configure # RIGHT
67 /berman/migchain/source/gdb-VERSION/gdb/configure # WRONG
69 The GDB package contains several subdirectories, such as 'gdb',
70 'bfd', and 'readline'. If your 'configure' line ends in
71 'gdb-VERSION/gdb/configure', then you are configuring only the gdb
72 subdirectory, not the whole GDB package. This leads to build errors
75 make: *** No rule to make target `../bfd/bfd.h', needed by `gdb.o'. Stop.
77 If you get other compiler errors during this stage, see the `Reporting
78 Bugs' section below; there are a few known problems.
80 GDB requires an ISO C (ANSI C) compiler. If you do not have an ISO
81 C compiler for your system, you may be able to download and install
82 the GNU CC compiler. It is available via anonymous FTP from the
83 directory `ftp://ftp.gnu.org/pub/gnu/gcc'. GDB also requires an ISO
84 C standard library. The GDB remote server, GDBserver, builds with some
85 non-ISO standard libraries - e.g. for Windows CE.
87 GDB uses Expat, an XML parsing library, to implement some target-specific
88 features. Expat will be linked in if it is available at build time, or
89 those features will be disabled. The latest version of Expat should be
90 available from `http://expat.sourceforge.net'.
92 GDB uses GNU MPFR, a library for multiple-precision floating-point
93 computation with correct rounding, to emulate target floating-point
94 arithmetic during expression evaluation when the target uses different
95 floating-point formats than the host. MPFR will be linked in if it is
96 available at build time. If GNU MPFR it is not available, GDB will fall
97 back to using host floating-point arithmetic. The latest version of
98 GNU MPFR should be available from `http://www.mpfr.org'.
100 GDB can be used as a cross-debugger, running on a machine of one
101 type while debugging a program running on a machine of another type.
108 All the documentation for GDB comes as part of the machine-readable
109 distribution. The documentation is written in Texinfo format, which
110 is a documentation system that uses a single source file to produce
111 both on-line information and a printed manual. You can use one of the
112 Info formatting commands to create the on-line version of the
113 documentation and TeX (or `texi2roff') to typeset the printed version.
115 GDB includes an already formatted copy of the on-line Info version
116 of this manual in the `gdb/doc' subdirectory. The main Info file is
117 `gdb-VERSION/gdb/doc/gdb.info', and it refers to subordinate files
118 matching `gdb.info*' in the same directory. If necessary, you can
119 print out these files, or read them with any editor; but they are
120 easier to read using the `info' subsystem in GNU Emacs or the
121 standalone `info' program, available as part of the GNU Texinfo
124 If you want to format these Info files yourself, you need one of the
125 Info formatting programs, such as `texinfo-format-buffer' or
128 If you have `makeinfo' installed, and are in the top level GDB
129 source directory (`gdb-VERSION'), you can make the Info file by
135 If you want to typeset and print copies of this manual, you need
136 TeX, a program to print its DVI output files, and `texinfo.tex', the
137 Texinfo definitions file. This file is included in the GDB
138 distribution, in the directory `gdb-VERSION/texinfo'.
140 TeX is a typesetting program; it does not print files directly, but
141 produces output files called DVI files. To print a typeset document,
142 you need a program to print DVI files. If your system has TeX
143 installed, chances are it has such a program. The precise command to
144 use depends on your system; `lpr -d' is common; another (for PostScript
145 devices) is `dvips'. The DVI print command may require a file name
146 without any extension or a `.dvi' extension.
148 TeX also requires a macro definitions file called `texinfo.tex'.
149 This file tells TeX how to typeset a document written in Texinfo
150 format. On its own, TeX cannot read, much less typeset a Texinfo file.
151 `texinfo.tex' is distributed with GDB and is located in the
152 `gdb-VERSION/texinfo' directory.
154 If you have TeX and a DVI printer program installed, you can typeset
155 and print this manual. First switch to the `gdb' subdirectory of
156 the main source directory (for example, to `gdb-VERSION/gdb') and then type:
160 If you prefer to have the manual in PDF format, type this from the
161 `gdb/doc' subdirectory of the main source directory:
165 For this to work, you will need the PDFTeX package to be installed.
171 GDB comes with a `configure' script that automates the process of
172 preparing GDB for installation; you can then use `make' to build the
175 The GDB distribution includes all the source code you need for GDB in
176 a single directory. That directory contains:
178 `gdb-VERSION/{COPYING,COPYING.LIB}'
179 Standard GNU license files. Please read them.
182 source for the Binary File Descriptor library
184 `gdb-VERSION/config*'
185 script for configuring GDB, along with other support files
188 the source specific to GDB itself
190 `gdb-VERSION/include'
193 `gdb-VERSION/libiberty'
194 source for the `-liberty' free software library
196 `gdb-VERSION/opcodes'
197 source for the library of opcode tables and disassemblers
199 `gdb-VERSION/readline'
200 source for the GNU command-line interface
201 NOTE: The readline library is compiled for use by GDB, but will
202 not be installed on your system when "make install" is issued.
205 source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
207 `gdb-VERSION/texinfo'
208 The `texinfo.tex' file, which you need in order to make a printed
212 Coding standards, useful files for editing GDB, and other
215 Note: the following instructions are for building GDB on Unix or
216 Unix-like systems. Instructions for building with DJGPP for
217 MS-DOS/MS-Windows are in the file gdb/config/djgpp/README.
219 The simplest way to configure and build GDB is to run `configure'
220 from the `gdb-VERSION' directory.
222 First switch to the `gdb-VERSION' source directory if you are
223 not already in it; then run `configure'.
231 Running `configure' followed by `make' builds the `bfd',
232 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
233 The configured source files, and the binaries, are left in the
234 corresponding source directories.
236 `configure' is a Bourne-shell (`/bin/sh') script; if your system
237 does not recognize this automatically when you run a different shell,
238 you may need to run `sh' on it explicitly:
242 If you run `configure' from a directory that contains source
243 directories for multiple libraries or programs, `configure' creates
244 configuration files for every directory level underneath (unless
245 you tell it not to, with the `--norecursion' option).
247 You can install `gdb' anywhere; it has no hardwired paths. However,
248 you should make sure that the shell on your path (named by the `SHELL'
249 environment variable) is publicly readable. Remember that GDB uses the
250 shell to start your program--some systems refuse to let GDB debug child
251 processes whose programs are not readable.
254 Compiling GDB in another directory
255 ==================================
257 If you want to run GDB versions for several host or target machines,
258 you need a different `gdb' compiled for each combination of host and
259 target. `configure' is designed to make this easy by allowing you to
260 generate each configuration in a separate subdirectory, rather than in
261 the source directory. If your `make' program handles the `VPATH'
262 feature correctly (GNU `make' and SunOS 'make' are two that should),
263 running `make' in each of these directories builds the `gdb' program
266 To build `gdb' in a separate directory, run `configure' with the
267 `--srcdir' option to specify where to find the source. (You also need
268 to specify a path to find `configure' itself from your working
269 directory. If the path to `configure' would be the same as the
270 argument to `--srcdir', you can leave out the `--srcdir' option; it
273 For example, you can build GDB in a separate
274 directory for a Sun 4 like this:
279 ../gdb-VERSION/configure
282 When `configure' builds a configuration using a remote source
283 directory, it creates a tree for the binaries with the same structure
284 (and using the same names) as the tree under the source directory. In
285 the example, you'd find the Sun 4 library `libiberty.a' in the
286 directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
288 One popular reason to build several GDB configurations in separate
289 directories is to configure GDB for cross-compiling (where GDB runs on
290 one machine--the host--while debugging programs that run on another
291 machine--the target). You specify a cross-debugging target by giving
292 the `--target=TARGET' option to `configure'.
294 When you run `make' to build a program or library, you must run it
295 in a configured directory--whatever directory you were in when you
296 called `configure' (or one of its subdirectories).
298 The `Makefile' that `configure' generates in each source directory
299 also runs recursively. If you type `make' in a source directory such
300 as `gdb-VERSION' (or in a separate configured directory configured with
301 `--srcdir=PATH/gdb-VERSION'), you will build all the required libraries,
304 When you have multiple hosts or targets configured in separate
305 directories, you can run `make' on them in parallel (for example, if
306 they are NFS-mounted on each of the hosts); they will not interfere
310 Specifying names for hosts and targets
311 ======================================
313 The specifications used for hosts and targets in the `configure'
314 script are based on a three-part naming scheme, but some short
315 predefined aliases are also supported. The full naming scheme encodes
316 three pieces of information in the following pattern:
318 ARCHITECTURE-VENDOR-OS
320 For example, you can use the alias `sun4' as a HOST argument or in a
321 `--target=TARGET' option. The equivalent full name is
324 The `configure' script accompanying GDB does not provide any query
325 facility to list all supported host and target names or aliases.
326 `configure' calls the Bourne shell script `config.sub' to map
327 abbreviations to full names; you can read the script, if you wish, or
328 you can use it to test your guesses on abbreviations--for example:
334 % sh config.sub decstation
336 % sh config.sub hp300bsd
338 % sh config.sub i386v
340 % sh config.sub i786v
341 Invalid configuration `i786v': machine `i786v' not recognized
343 `config.sub' is also distributed in the GDB source directory.
349 Here is a summary of the `configure' options and arguments that are
350 most often useful for building GDB. `configure' also has several other
351 options not listed here. *note : (configure.info)What Configure Does,
352 for a full explanation of `configure'.
357 [--norecursion] [--rm]
358 [--enable-build-warnings]
363 You may introduce options with a single `-' rather than `--' if you
364 prefer; but you may abbreviate option names if you use `--'.
367 Display a quick summary of how to invoke `configure'.
370 Configure the source to install programs and files under directory
374 *Warning: using this option requires GNU `make', or another `make'
375 that compatibly implements the `VPATH' feature.*
376 Use this option to make configurations in directories separate
377 from the GDB source directories. Among other things, you can use
378 this to build (or maintain) several configurations simultaneously,
379 in separate directories. `configure' writes configuration
380 specific files in the current directory, but arranges for them to
381 use the source in the directory PATH. `configure' will create
382 directories under the working directory in parallel to the source
383 directories below PATH.
386 Configure GDB to run on the specified HOST.
388 There is no convenient way to generate a list of all available
392 Same as `--host=HOST'. If you omit this, GDB will guess; it's
396 Configure only the directory level where `configure' is executed;
397 do not propagate configuration to subdirectories.
400 Remove the configuration that the other arguments specify.
402 `--enable-build-warnings'
403 When building the GDB sources, ask the compiler to warn about any
404 code which looks even vaguely suspicious. You should only using
405 this feature if you're compiling with GNU CC. It passes the
416 Treat compiler warnings as werrors. Use this only with GCC. It
417 adds the -Werror flag to the compiler, which will fail the
418 compilation if the compiler outputs any warning messages.
421 Configure GDB for cross-debugging programs running on the specified
422 TARGET. Without this option, GDB is configured to debug programs
423 that run on the same machine (HOST) as GDB itself.
425 There is no convenient way to generate a list of all available
428 `--with-gdb-datadir=PATH'
429 Set the GDB-specific data directory. GDB will look here for
430 certain supporting files or scripts. This defaults to the `gdb'
431 subdirectory of `datadir' (which can be set using `--datadir').
433 `--with-relocated-sources=DIR'
434 Sets up the default source path substitution rule so that
435 directory names recorded in debug information will be
436 automatically adjusted for any directory under DIR. DIR should
437 be a subdirectory of GDB's configured prefix, the one mentioned
438 in the `--prefix' or `--exec-prefix' options to configure. This
439 option is useful if GDB is supposed to be moved to a different
440 place after it is built.
442 `--enable-64-bit-bfd'
443 Enable 64-bit support in BFD on 32-bit hosts.
446 Build GDB without the GDB/MI machine interface.
449 Build GDB with the text-mode full-screen user interface (TUI).
450 Requires a curses library (ncurses and cursesX are also
454 Build GDB with the gdbtk GUI interface. Requires TCL/Tk to be
457 `--with-libunwind-ia64'
458 Use the libunwind library for unwinding function call stack on ia64
460 See http://www.nongnu.org/libunwind/index.html for details.
463 Use the curses library instead of the termcap library, for
464 text-mode terminal operations.
466 `--enable-profiling' Enable profiling of GDB itself. Necessary if you
467 want to use the "maint set profile" command for profiling GDB.
468 Requires the functions `monstartup' and `_mcleanup' to be present
469 in the standard C library used to build GDB, and also requires a
470 compiler that supports the `-pg' option.
472 `--with-system-readline'
473 Use the readline library installed on the host, rather than the
474 library supplied as part of GDB tarball.
477 Build GDB with the libexpat library. (Done by default if
478 libexpat is installed and found at configure time.) This library
479 is used to read XML files supplied with GDB. If it is
480 unavailable, some features, such as remote protocol memory maps,
481 target descriptions, and shared library lists, that are based on
482 XML files, will not be available in GDB. If your host does not
483 have libexpat installed, you can get the latest version from
484 http://expat.sourceforge.net.
487 Build GDB with the GNU MPFR library. (Done by default if
488 GNU MPFR is installed and found at configure time.) This library
489 is used to emulate target floating-point arithmetic during expression
490 evaluation when the target uses different floating-point formats than
491 the host. If GNU MPFR is not available, GDB will fall back to using
492 host floating-point arithmetic. If your host does not have GNU MPFR
493 installed, you can get the latest version from http://www.mpfr.org.
495 `--with-python[=PATH]'
496 Build GDB with Python scripting support. (Done by default if
497 libpython is present and found at configure time.) Python makes
498 GDB scripting much more powerful than the restricted CLI
499 scripting language. If your host does not have Python installed,
500 you can find it on http://www.python.org/download/. The oldest
501 version of Python supported by GDB is 2.4. The optional argument
502 PATH says where to find the Python headers and libraries; the
503 configure script will look in PATH/include for headers and in
504 PATH/lib for the libraries.
506 `--without-included-regex'
507 Don't use the regex library included with GDB (as part of the
508 libiberty library). This is the default on hosts with version 2
509 of the GNU C library.
512 Use DIR as the default system root directory for libraries whose
513 file names begin with `/lib' or `/usr/lib'. (The value of DIR
514 can be modified at run time by using the "set sysroot" command.)
515 If DIR is under the GDB configured prefix (set with `--prefix' or
516 `--exec-prefix' options), the default system root will be
517 automatically adjusted if and when GDB is moved to a different
520 `--with-system-gdbinit=FILE'
521 Configure GDB to automatically load a system-wide init file.
522 FILE should be an absolute file name. If FILE is in a directory
523 under the configured prefix, and GDB is moved to another location
524 after being built, the location of the system-wide init file will
525 be adjusted accordingly.
527 `configure' accepts other options, for compatibility with configuring
528 other GNU tools recursively; but these are the only options that affect
529 GDB or its supporting libraries.
535 The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples
536 of remote stubs to be used with remote.c. They are designed to run
537 standalone on an m68k, i386, or SPARC cpu and communicate properly
538 with the remote.c stub over a serial line.
540 The directory gdb/gdbserver/ contains `gdbserver', a program that
541 allows remote debugging for Unix applications. GDBserver is only
542 supported for some native configurations, including Sun 3, Sun 4, and
544 The file gdb/gdbserver/README includes further notes on GDBserver; in
545 particular, it explains how to build GDBserver for cross-debugging
546 (where GDBserver runs on the target machine, which is of a different
547 architecture than the host machine running GDB).
549 There are a number of remote interfaces for talking to existing ROM
550 monitors and other hardware:
552 remote-mips.c MIPS remote debugging protocol
553 remote-sds.c PowerPC SDS monitor
554 remote-sim.c Generalized simulator protocol
557 Reporting Bugs in GDB
558 =====================
560 There are several ways of reporting bugs in GDB. The prefered
561 method is to use the World Wide Web:
563 http://www.gnu.org/software/gdb/bugs/
565 As an alternative, the bug report can be submitted, via e-mail, to the
566 address "bug-gdb@gnu.org".
568 When submitting a bug, please include the GDB version number, and
569 how you configured it (e.g., "sun4" or "mach386 host,
570 i586-intel-synopsys target"). Since GDB now supports so many
571 different configurations, it is important that you be precise about
572 this. If at all possible, you should include the actual banner
573 that GDB prints when it starts up, or failing that, the actual
574 configure command that you used when configuring GDB.
576 For more information on how/whether to report bugs, see the
577 Reporting Bugs chapter of the GDB manual (gdb/doc/gdb.texinfo).
580 Graphical interface to GDB -- X Windows, MS Windows
581 ==========================
583 Several graphical interfaces to GDB are available. You should
586 http://www.gnu.org/software/gdb/links/
588 for an up-to-date list.
590 Emacs users will very likely enjoy the Grand Unified Debugger mode;
591 try typing `M-x gdb RET'.
595 =====================
597 There is information about writing code for GDB in the file
598 `CONTRIBUTE' and at the website:
600 http://www.gnu.org/software/gdb/
602 in particular in the wiki.
604 If you are pondering writing anything but a short patch, especially
605 take note of the information about copyrights and copyright assignment.
606 It can take quite a while to get all the paperwork done, so
607 we encourage you to start that process as soon as you decide you are
608 planning to work on something, or at least well ahead of when you
609 think you will be ready to submit the patches.
615 Included with the GDB distribution is a DejaGNU based testsuite
616 that can either be used to test your newly built GDB, or for
617 regression testing a GDB with local modifications.
619 Running the testsuite requires the prior installation of DejaGNU,
620 which is generally available via ftp. The directory
621 ftp://sources.redhat.com/pub/dejagnu/ will contain a recent snapshot.
622 Once DejaGNU is installed, you can run the tests in one of the
630 (2) cd gdb-VERSION/gdb
635 (3) cd gdb-VERSION/gdb/testsuite
636 make site.exp (builds the site specific file)
637 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
639 When using a `make'-based method, you can use the Makefile variable
640 `RUNTESTFLAGS' to pass flags to `runtest', e.g.:
642 make RUNTESTFLAGS=--directory=gdb.cp check
644 If you use GNU make, you can use its `-j' option to run the testsuite
645 in parallel. This can greatly reduce the amount of time it takes for
646 the testsuite to run. In this case, if you set `RUNTESTFLAGS' then,
647 by default, the tests will be run serially even under `-j'. You can
648 override this and force a parallel run by setting the `make' variable
649 `FORCE_PARALLEL' to any non-empty value. Note that the parallel `make
650 check' assumes that you want to run the entire testsuite, so it is not
651 compatible with some dejagnu options, like `--directory'.
653 The last method gives you slightly more control in case of problems
654 with building one or more test executables or if you are using the
655 testsuite `standalone', without it being part of the GDB source tree.
657 See the DejaGNU documentation for further details.
660 Copyright and License Notices
661 =============================
663 Most files maintained by the GDB Project contain a copyright notice
664 as well as a license notice, usually at the start of the file.
666 To reduce the length of copyright notices, consecutive years in the
667 copyright notice can be combined into a single range. For instance,
668 the following list of copyright years...
670 1986, 1988, 1989, 1991-1993, 1999, 2000, 2007, 2008, 2009, 2010, 2011
672 ... is abbreviated into:
674 1986, 1988-1989, 1991-1993, 1999-2000, 2007-2011
676 Every year of each range, inclusive, is a copyrightable year that
677 could be listed individually.
680 (this is for editing this file with GNU emacs)