1 README for gdb-5.0 release
2 Updated 11 May 2000 by Andrew Cagney
4 This is GDB, the GNU source-level debugger.
5 A summary of new features is in the file `NEWS'.
7 See the GDB home page at http://sourceware.cygnus.com/gdb/ for up to
8 date release information, mailing list links and archives, etc.
11 Unpacking and Installation -- quick overview
12 ==========================
14 In this release, the GDB debugger sources, the generic GNU include
15 files, the BFD ("binary file description") library, the readline
16 library, and other libraries all have directories of their own
17 underneath the gdb-5.0 directory. The idea is that a variety of GNU
18 tools can share a common copy of these things. Be aware of variation
19 over time--for example don't try to build gdb with a copy of bfd from
20 a release other than the gdb release (such as a binutils or gas
21 release), especially if the releases are more than a few weeks apart.
22 Configuration scripts and makefiles exist to cruise up and down this
23 directory tree and automatically build all the pieces in the right
26 When you unpack the gdb-5.0.tar.gz file, you'll find a directory
27 called `gdb-5.0', which contains:
29 COPYING config.if install-sh mmalloc readline
30 COPYING.LIB config.sub intl move-if-change sim
31 Makefile.in configure libiberty mpw-README symlink-tree
32 README configure.in ltconfig mpw-build.in texinfo
33 bfd djunpack.bat ltmain.sh mpw-config.in utils
34 config etc md5.sum mpw-configure ylwrap
35 config-ml.in gdb missing mpw-install
36 config.guess include mkinstalldirs opcodes
38 You can build GDB right in the source directory:
43 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
45 However, we recommend that an empty directory be used instead.
46 This way you do not clutter your source tree with binary files
47 and will be able to create different builds with different
48 configuration options.
50 You can build GDB in any empty build directory:
55 <full path to your sources>/gdb-5.0/configure
58 (Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
59 different; see the file gdb-5.0/gdb/config/djgpp/README for details.)
61 This will configure and build all the libraries as well as GDB. If
62 `configure' can't determine your system type, specify one as its
63 argument, e.g., `./configure sun4' or `./configure decstation'.
65 If you get compiler errors during this stage, see the `Reporting
66 Bugs' section below; there are a few known problems.
68 GDB requires an ISO-C (ANSI C) compiler. If you do not have an
69 ISO-C compiler for your system, you may be able to download and
70 install the GNU CC compiler. It is available via anonymous FTP from
71 the directory `ftp://ftp.gnu.org/pub/gnu/gcc'.
73 GDB can be used as a cross-debugger, running on a machine of one
74 type while debugging a program running on a machine of another type.
81 All the documentation for GDB comes as part of the machine-readable
82 distribution. The documentation is written in Texinfo format, which
83 is a documentation system that uses a single source file to produce
84 both on-line information and a printed manual. You can use one of the
85 Info formatting commands to create the on-line version of the
86 documentation and TeX (or `texi2roff') to typeset the printed version.
88 GDB includes an already formatted copy of the on-line Info version
89 of this manual in the `gdb/doc' subdirectory. The main Info file is
90 `gdb-5.0/gdb/doc/gdb.info', and it refers to subordinate files
91 matching `gdb.info*' in the same directory. If necessary, you can
92 print out these files, or read them with any editor; but they are
93 easier to read using the `info' subsystem in GNU Emacs or the
94 standalone `info' program, available as part of the GNU Texinfo
97 If you want to format these Info files yourself, you need one of the
98 Info formatting programs, such as `texinfo-format-buffer' or
101 If you have `makeinfo' installed, and are in the top level GDB
102 source directory (`gdb-5.0', in the case of version 5.0), you can make
103 the Info file by typing:
108 If you want to typeset and print copies of this manual, you need
109 TeX, a program to print its DVI output files, and `texinfo.tex', the
110 Texinfo definitions file. This file is included in the GDB
111 distribution, in the directory `gdb-5.0/texinfo'.
113 TeX is a typesetting program; it does not print files directly, but
114 produces output files called DVI files. To print a typeset document,
115 you need a program to print DVI files. If your system has TeX
116 installed, chances are it has such a program. The precise command to
117 use depends on your system; `lpr -d' is common; another (for PostScript
118 devices) is `dvips'. The DVI print command may require a file name
119 without any extension or a `.dvi' extension.
121 TeX also requires a macro definitions file called `texinfo.tex'.
122 This file tells TeX how to typeset a document written in Texinfo
123 format. On its own, TeX cannot read, much less typeset a Texinfo file.
124 `texinfo.tex' is distributed with GDB and is located in the
125 `gdb-5.0/texinfo' directory.
127 If you have TeX and a DVI printer program installed, you can typeset
128 and print this manual. First switch to the the `gdb' subdirectory of
129 the main source directory (for example, to `gdb-5.0/gdb') and then type:
133 If you prefer to have the manual in PDF format, type this from the
134 `gdb/doc' subdirectory of the main source directory:
138 For this to work, you will need the PDFTeX package to be installed.
144 GDB comes with a `configure' script that automates the process of
145 preparing GDB for installation; you can then use `make' to build the
148 The GDB distribution includes all the source code you need for GDB in
149 a single directory, whose name is usually composed by appending the
150 version number to `gdb'.
152 For example, the GDB version 5.0 distribution is in the `gdb-5.0'
153 directory. That directory contains:
155 `gdb-5.0/{COPYING,COPYING.LIB}'
156 Standard GNU license files. Please read them.
159 source for the Binary File Descriptor library
162 script for configuring GDB, along with other support files
165 the source specific to GDB itself
171 source for the `-liberty' free software library
174 source for the GNU memory-mapped malloc package
177 source for the library of opcode tables and disassemblers
180 source for the GNU command-line interface
181 NOTE: The readline library is compiled for use by GDB, but will
182 not be installed on your system when "make install" is issued.
185 source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
188 source for the GNU gettext library, for internationalization.
189 This is slightly modified from the standalone gettext
190 distribution you can get from GNU.
193 The `texinfo.tex' file, which you need in order to make a printed
197 Coding standards, useful files for editing GDB, and other
201 A grab bag of random utilities.
203 Note: the following instructions are for building GDB on Unix or
204 Unix-like systems. Instructions for building with DJGPP for
205 MS-DOS/MS-Windows are in the file gdb/config/djgpp/README.
207 The simplest way to configure and build GDB is to run `configure'
208 from the `gdb-VERSION-NUMBER' source directory, which in this example
209 is the `gdb-5.0' directory.
211 First switch to the `gdb-VERSION-NUMBER' source directory if you are
212 not already in it; then run `configure'.
220 Running `configure' followed by `make' builds the `bfd',
221 `readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
222 The configured source files, and the binaries, are left in the
223 corresponding source directories.
225 `configure' is a Bourne-shell (`/bin/sh') script; if your system
226 does not recognize this automatically when you run a different shell,
227 you may need to run `sh' on it explicitly:
231 If you run `configure' from a directory that contains source
232 directories for multiple libraries or programs, such as the `gdb-5.0'
233 source directory for version 5.0, `configure' creates configuration
234 files for every directory level underneath (unless you tell it not to,
235 with the `--norecursion' option).
237 You can run the `configure' script from any of the subordinate
238 directories in the GDB distribution, if you only want to configure that
239 subdirectory; but be sure to specify a path to it.
241 For example, with version 5.0, type the following to configure only
242 the `bfd' subdirectory:
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, with version 5.0, you can build GDB in a separate
274 directory for a Sun 4 like this:
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-5.0' (or in a separate configured directory configured with
301 `--srcdir=PATH/gdb-5.0'), 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
344 (`gdb-5.0', for version 5.0).
350 Here is a summary of the `configure' options and arguments that are
351 most often useful for building GDB. `configure' also has several other
352 options not listed here. *note : (configure.info)What Configure Does,
353 for a full explanation of `configure'.
358 [--norecursion] [--rm]
359 [--enable-build-warnings]
364 You may introduce options with a single `-' rather than `--' if you
365 prefer; but you may abbreviate option names if you use `--'.
368 Display a quick summary of how to invoke `configure'.
371 Configure the source to install programs and files under directory
375 *Warning: using this option requires GNU `make', or another `make'
376 that compatibly implements the `VPATH' feature.*
377 Use this option to make configurations in directories separate
378 from the GDB source directories. Among other things, you can use
379 this to build (or maintain) several configurations simultaneously,
380 in separate directories. `configure' writes configuration
381 specific files in the current directory, but arranges for them to
382 use the source in the directory PATH. `configure' will create
383 directories under the working directory in parallel to the source
384 directories below PATH.
387 Configure only the directory level where `configure' is executed;
388 do not propagate configuration to subdirectories.
391 Remove the configuration that the other arguments specify.
393 `--enable-build-warnings'
394 When building the GDB sources, ask the compiler to warn about any
395 code which looks even vaguely suspicious. You should only using
396 this feature if you're compiling with GNU CC. It passes the
407 Configure GDB for cross-debugging programs running on the specified
408 TARGET. Without this option, GDB is configured to debug programs
409 that run on the same machine (HOST) as GDB itself.
411 There is no convenient way to generate a list of all available
415 Configure GDB to run on the specified HOST.
417 There is no convenient way to generate a list of all available
421 Same as `--host=HOST'. If you omit this, GDB will guess; it's
424 `configure' accepts other options, for compatibility with configuring
425 other GNU tools recursively; but these are the only options that affect
426 GDB or its supporting libraries.
429 Languages other than C
430 =======================
432 See the GDB manual (gdb/doc/gdb.texinfo) for information on this.
438 Remote debugging over serial lines works fine, but the kernel
439 debugging code in here has not been tested in years. Van Jacobson has
440 better kernel debugging, but the UC lawyers won't let FSF have it.
446 The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples
447 of remote stubs to be used with remote.c. They are designed to run
448 standalone on an m68k, i386, or SPARC cpu and communicate properly
449 with the remote.c stub over a serial line.
451 The directory gdb/gdbserver/ contains `gdbserver', a program that
452 allows remote debugging for Unix applications. gdbserver is only
453 supported for some native configurations, including Sun 3, Sun 4, and
456 There are a number of remote interfaces for talking to existing ROM
457 monitors and other hardware:
459 remote-adapt.c AMD 29000 "Adapt"
460 remote-array.c Array Tech RAID controller
461 remote-bug.c Motorola BUG monitor
462 remote-e7000.c Hitachi E7000 ICE
463 remote-eb.c AMD 29000 "EBMON"
464 remote-es.c Ericsson 1800 monitor
465 remote-est.c EST emulator
466 remote-hms.c Hitachi Micro Systems H8/300 monitor
467 remote-mips.c MIPS remote debugging protocol
468 remote-mm.c AMD 29000 "minimon"
469 remote-nindy.c Intel 960 "Nindy"
470 remote-nrom.c NetROM ROM emulator
471 remote-os9k.c PC running OS/9000
472 remote-rdi.c ARM with Angel monitor
473 remote-rdp.c ARM with Demon monitor
474 remote-sds.c PowerPC SDS monitor
475 remote-sim.c Generalized simulator protocol
476 remote-st.c Tandem ST-2000 monitor
477 remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
478 remote-vx.c VxWorks realtime kernel
480 Remote-vx.c and the vx-share subdirectory contain a remote
481 interface for the VxWorks realtime kernel, which communicates over TCP
482 using the Sun RPC library. This would be a useful starting point for
483 other remote- via-ethernet back ends.
485 Remote-udi.c and the 29k-share subdirectory contain a remote
486 interface for AMD 29000 programs, which uses the AMD "Universal Debug
487 Interface". This allows GDB to talk to software simulators,
488 emulators, and/or bare hardware boards, via network or serial
489 interfaces. Note that GDB only provides an interface that speaks UDI,
490 not a complete solution. You will need something on the other end
491 that also speaks UDI.
497 The correct address for reporting bugs found in gdb is
498 "bug-gdb@gnu.org". Please email all bugs, and all requests for help
499 with GDB, to that address. Please include the GDB version number
500 (e.g., gdb-5.0), and how you configured it (e.g., "sun4" or "mach386
501 host, i586-intel-synopsys target"). Since GDB now supports so many
502 different configurations, it is important that you be precise about
503 this. If at all possible, you should include the actual banner that
504 GDB prints when it starts up, or failing that, the actual configure
505 command that you used when configuring GDB.
507 For more information on how/whether to report bugs, see the GDB
508 Bugs section of the GDB manual (gdb/doc/gdb.texinfo) or the
513 * Under Ultrix 4.2 (DECstation-3100) or Alphas under OSF/1, we have
514 seen problems with backtraces after interrupting the inferior out
515 of a read(). The problem is caused by ptrace() returning an
516 incorrect value for the frame pointer register (register 15 or
517 30). As far as we can tell, this is a kernel problem. Any help
518 with this would be greatly appreciated.
520 * Under Ultrix 4.4 (DECstation-3100), setting the TERMCAP environment
521 variable to a string without a trailing ':' can cause GDB to dump
522 core upon startup. Although the core file makes it look as though
523 GDB code failed, the crash actually occurs within a call to the
524 termcap library function tgetent(). The problem can be solved by
525 using the GNU Termcap library.
527 Alphas running OSF/1 (versions 1.0 through 2.1) have the same buggy
528 termcap code, but GDB behaves strangely rather than crashing.
530 * On DECstations there are warnings about shift counts out of range in
531 various BFD modules. None of them is a cause for alarm, they are actually
532 a result of bugs in the DECstation compiler.
534 * Notes for the DEC Alpha using OSF/1:
535 The debugging output of native cc has two known problems; we view these
537 The linker miscompacts symbol tables, which causes gdb to confuse the
538 type of variables or results in `struct <illegal>' type outputs.
539 dbx has the same problems with those executables. A workaround is to
540 specify -Wl,-b when linking, but that will increase the executable size
542 If a structure has incomplete type in one file (e.g., "struct foo *"
543 without a definition for "struct foo"), gdb will be unable to find the
544 structure definition from another file.
545 It has been reported that the Ultrix 4.3A compiler on decstations has the
548 * Notes for Solaris 2.x, using the SPARCworks cc compiler:
549 You have to compile your program with the -xs option of the SPARCworks
550 compiler to be able to debug your program with gdb.
551 Under Solaris 2.3 you also need patch 101409-03 (Jumbo linker patch).
552 Under Solaris 2.2, if you have patch 101052 installed, make sure
553 that it is at least at revision 101052-06.
555 * Under Irix 5 for SGIs, you must have installed the `compiler_dev.hdr'
556 subsystem that is on the IDO CD, otherwise you will get complaints
557 that certain files such as `/usr/include/syms.h' cannot be found.
559 * Under Irix 6 you must build with GCC. The vendor compiler reports
560 as errors certain assignments that GCC considers to be warnings.
562 GDB can produce warnings about symbols that it does not understand.
563 By default, these warnings are disabled. You can enable them by
564 executing `set complaint 10' (which you can put in your ~/.gdbinit if
565 you like). I recommend doing this if you are working on a compiler,
566 assembler, linker, or GDB, since it will point out problems that you
567 may be able to fix. Warnings produced during symbol reading indicate
568 some mismatch between the object file and GDB's symbol reading code.
569 In many cases, it's a mismatch between the specs for the object file
570 format, and what the compiler actually outputs or the debugger
571 actually understands.
574 Graphical interface to GDB -- X Windows, MS Windows
575 ==========================
577 Several graphical interfaces to GDB are available. You should
580 http://sourceware.cygnus.com/gdb/#gui
582 for an up-to-date list.
584 Emacs users will very likely enjoy the Grand Unified Debugger mode;
585 try typing `M-x gdb RET'.
589 =====================
591 There is a lot of information about writing code for GDB in the
592 internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
593 can read it by hand, print it by using TeX and texinfo, or process it
594 into an `info' file for use with Emacs' info mode or the standalone
597 If you are pondering writing anything but a short patch, especially
598 take note of the information about copyrights in the node Submitting
599 Patches. It can take quite a while to get all the paperwork done, so
600 we encourage you to start that process as soon as you decide you are
601 planning to work on something, or at least well ahead of when you
602 think you will be ready to submit the patches.
608 Included with the GDB distribution is a DejaGNU based testsuite
609 that can either be used to test your newly built GDB, or for
610 regression testing a GDB with local modifications.
612 Running the testsuite requires the prior installation of DejaGNU,
613 which is generally available via ftp. The directory
614 ftp://sourceware.cygnus.com/pub/dejagnu/ will contain a recent
615 snapshot. Once DejaGNU is installed, you can run the tests in one of
628 (3) cd gdb-5.0/gdb/testsuite
629 make site.exp (builds the site specific file)
630 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
632 The last method gives you slightly more control in case of problems
633 with building one or more test executables or if you are using the
634 testsuite `standalone', without it being part of the GDB source tree.
636 See the DejaGNU documentation for further details.
639 (this is for editing this file with GNU emacs)