1 README for gdb-4.0 release
4 This is GDB, the GNU source-level debugger, presently running under un*x.
5 A summary of features new since gdb-3.5 is in the file `WHATS.NEW'.
8 Unpacking and Installation -- quick overview
9 ==========================
11 This release moves the generic GNU include files, the BFD ("binary file
12 description") library, the getopt routines, obstacks, and the readline
13 library into the parent directory of the gdb source files. The idea is
14 that a variety of GNU tools can share a common copy of these things.
16 These generic files are packaged together with the directory containing
17 the source code for GDB, for now. When you unpack the gdb-4.0.tar.Z
18 file, you'll get a directory called `gdb-4.0', which contains:
20 Makefile.in bfd/ configure.in libiberty/
21 README config.sub* gdb/ readline/
22 README.configure configure* include/ texinfo/
24 To build GDB, you can just do:
29 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
31 This will configure and build all the libraries as well as GDB.
32 If you get compiler warnings during this stage, see the `Reporting Bugs'
33 section below; there are a few known problems.
35 GDB can be used as a cross-debugger, running on a machine of one type
36 while debugging a program running on a machine of another type. See below.
42 The GDB 4.0 release includes an already-formatted reference card, ready
43 for printing on a PostScript printer, as `gdb-4.0/gdb/refcard.ps'. It
44 uses the most common PostScript fonts: the Times family, Courier,
45 and Symbol. If you have a PostScript printer you can print the
46 reference card by just sending `refcard.ps' to the printer.
48 The release also includes the online Info version of the manual
49 already formatted: the main Info file is `gdb-4.0/gdb/gdb.info', and
50 it refers to subordinate files matching `gdb.info*' in the same
53 If you want to make these Info files yourself from the GDB
54 manual's source, you need the GNU `makeinfo' program. Once you have
60 to make the Info file.
62 If you want to format and print copies of this manual, you need
65 * TeX, the public domain typesetting program written by Donald
66 Knuth, must be installed on your system and available through
69 * `gdb-4.0/texinfo': TeX macros defining the GNU Documentation
72 * *A DVI output program.* TeX doesn't actually make marks on
73 paper; it produces output files called DVI files. If your
74 system has TeX installed, chances are it has a program for
75 printing out these files; one popular example is `dvips', which
76 can print DVI files on PostScript printers.
78 Once you have these things, you can type
83 to format the text of this manual, and print it with the usual output
84 method for TeX DVI files at your site.
86 If you want to print the reference card, but don't have a PostScript
87 printer, or want to print using Computer Modern fonts instead, you can
88 still print it if you have TeX. Format the reference card by typing
93 The GDB reference card is designed to print in landscape mode on US
94 "letter" size paper; that is, on a sheet 11 inches wide by 8.5
95 inches high. You will need to specify this form of printing as an
96 option to your DVI output program.
102 GDB comes with a `configure' script that automates the process of
103 preparing GDB for installation; you can then use `make' to build the
106 The gdb distribution includes all the source code you need for gdb
107 in a single directory `gdb-4.0'. That directory in turn contains:
110 Overall script for configuring GDB and all its supporting
114 the source specific to GDB itself
117 source for the Binary File Descriptor Library
123 source for the `-liberty' free software library
126 source for the GNU command-line interface
128 Each of these directories has its own `configure' script, which are
129 used by the overall `configure' script in `gdb-4.0'.
131 It is most convenient to run `configure' from the `gdb-4.0'
132 directory. The simplest way to configure and build GDB is the
139 where HOST is something like `sun4' or `decstation', that identifies
140 the platform where GDB will run. This builds the three libraries
141 `bfd', `readline', and `libiberty', then `gdb' itself. The
142 configured source files, and the binaries, are left in the
143 corresponding source directories.
145 You can install `gdb' anywhere; it has no hardwired paths.
146 However, you should make sure that the shell on your path (named by
147 the `SHELL' environment variable) is publicly readable; some systems
148 refuse to let GDB debug child processes whose programs are not
149 readable, and GDB uses the shell to start your program.
151 Configuration Subdirectories
152 ============================
154 If you want to run GDB versions for several host or target
155 machines, you'll need a different gdb compiled for each combination
156 of host and target. `configure' is designed to make this easy by
157 allowing you to generate each configuration in a separate
158 subdirectory. If your `make' program handles the `VPATH' feature
159 (GNU `make' does), running `make' in each of these directories then
160 builds the gdb program specified there.
162 `configure' creates these subdirectories for you when you
163 simultaneously specify several configurations; but it's a good habit
164 even for a single configuration. You can specify the use of
165 subdirectories using the `+subdirs' option (abbreviated `+sub').
166 For example, you can build GDB on a Sun 4 as follows:
169 ./configure +sub sun4
170 cd Host-sparc-sun-sunos4/Target-sparc-sun-sunos4
173 When `configure' uses subdirectories to build programs or
174 libraries, it creates nested directories `Host-HOST/Target-TARGET'.
175 (As you see in the example, the names used for HOST and TARGET may
176 be expanded from your `configure' argument; *note Config Names::.).
177 `configure' uses these two directory levels because GDB can be
178 configured for cross-compiling: GDB can run on one machine (the
179 host) while debugging programs that run on another machine (the
180 target). You specify cross-debugging targets by giving the
181 `+target=TARGET' option to `configure'. Specifying only hosts still
182 gives you two levels of subdirectory for each host, with the same
183 configuration suffix on both; that is, if you give any number of
184 hosts but no targets, GDB will be configured for native debugging on
185 each host. On the other hand, whenever you specify both hosts and
186 targets on the same command line, `configure' creates all
187 combinations of the hosts and targets you list.
189 When you run `make' to build a program or library, you must run it
190 in a configured directory. If you made a single configuration,
191 without subdirectories, run `make' in the source directory. If you
192 have `Host-HOST/Target-TARGET' subdirectories, run `make' in those
195 Each `configure' and `Makefile' under each source directory runs
196 recursively, so that typing `make' in `gdb-4.0' (or in a
197 `gdb-4.0/Host-HOST/Target-TARGET' subdirectory) builds all the
198 required libraries, then GDB.
200 If you run `configure' from a directory (such as `gdb-4.0') that
201 contains source directories for multiple libraries or programs,
202 `configure' creates the `Host-HOST/Target-TARGET' subdirectories in
203 each library or program's source directory. For example, typing:
206 configure sun4 +target=vxworks960
208 creates the following directories:
210 gdb-4.0/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
211 gdb-4.0/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
212 gdb-4.0/gdb/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
213 gdb-4.0/libiberty/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
214 gdb-4.0/readline/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
218 gdb-4.0/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
220 will `cd' to the appropriate lower-level directories, for example:
222 gdb-4.0/bfd/Host-sparc-sun-sunos4/Target-i960-wrs-vxworks
224 building each in turn.
226 When you have multiple hosts or targets configured, you can run
227 `make' on them in parallel (for example, if they are NFS-mounted on
228 each of the hosts); they will not interfere with each other.
230 Specifying Names for Hosts and Targets
231 ======================================
233 The specifications used for hosts and targets in the `configure'
234 script are based on a three-part naming scheme, but some short
235 predefined aliases are also supported. The full naming scheme
236 encodes three pieces of information in the following pattern:
238 ARCHITECTURE-VENDOR-OS
240 For example, you can use the alias `sun4' as a HOST argument or in
241 a `+target='TARGET option, but the full name of that configuration
242 specifies that the architecture is `sparc', the vendor is `sun', and
243 the operating system is `sunos4'.
245 The following table shows all the architectures, hosts, and OS
246 prefixes that `configure' recognizes in GDB 4.0. Entries in the "OS
248 column ending in a `*' may be followed by a release number.
251 ARCHITECTURE VENDOR OS prefix
252 ------------+-------------+-------------
255 alliant | aout | aout
260 i860 | convergent | dynix*
261 i960 | convex | esix*
267 pyramid | intel | none
270 sparc | mips | sunos*
271 tahoe | motorola | sysv*
284 *Warning:* Many combinations of architecture, vendor, and OS are
287 The `configure' script accompanying GDB 4.0 does not provide any
288 query facility to list all supported host and target names or
289 aliases. `configure' calls the Bourne shell script `config.sub' to
290 map abbreviations to full names; you can read the script, if you
291 wish, or you can use it to test your guesses on abbreviations--for
298 % sh config.sub decstation
300 % sh config.sub hp300bsd
302 % sh config.sub i386v
304 % sh config.sub i486v
305 *** No vendor: configuration `i486v' not recognized
310 Here is a summary of all the `configure' options and arguments
311 that you might use for building GDB:
313 configure [+destdir=DIR] [+subdirs] [+norecur] [+rm]
314 [+target=TARGET...] HOST...
316 You may introduce options with the character `-' rather than `+' if
317 you prefer; but you may abbreviate option names if you use `+'.
320 DIR is an installation directory *path prefix*. After you
321 configure with this option, `make install' will install GDB as
322 `DIR/bin/gdb', and the libraries in `DIR/lib'. If you specify
323 `+destdir=/usr/local', for example, `make install' creates
324 `/usr/local/bin/gdb'.
327 Write configuration specific files in subdirectories of the form
329 Host-HOST/Target-TARGET
331 (and configure the `Makefile' to write binaries there too).
332 Without this option, if you specify only one configuration for
333 GDB, `configure' will use the same directory for source,
334 configured files, and binaries. This option is used
335 automatically if you specify more than one HOST or more than
337 `+target=TARGET' option on the `configure' command line.
340 Configure only the directory where `configure' is executed; do
341 not propagate configuration to subdirectories.
344 Remove the configuration that the other arguments specify.
347 Configure GDB for cross-debugging programs running on each
348 specified TARGET. You may specify as many `+target' options as
349 you wish. Without this option, GDB is configured to debug
350 programs that run on the same machine (HOST) as GDB itself.
352 There is no convenient way to generate a list of all available
356 Configure GDB to run on each specified HOST. You may specify as
357 many host names as you wish.
359 There is no convenient way to generate a list of all available
362 `configure' accepts other options, for compatibility with configuring
363 other GNU tools recursively; but these are the only options that
364 affect GDB or its supporting libraries.
367 Languages other than C
369 C++ support has been integrated into gdb. GDB should work with FORTRAN
370 programs. (If you have problems, please send a bug report; you may
371 have to refer to some FORTRAN variables with a trailing underscore).
372 Andrew Beers has produced a GDB that works with Modula-2, which will
373 appear in gdb-4.1. I am not aware of anyone who is working on getting
374 gdb to use the syntax of any other language. Pascal programs which use
375 sets, subranges, file variables, or nested functions will not currently
381 I have't done this myself so I can't really offer any advice.
382 Remote debugging over serial lines works fine, but the kernel debugging
383 code in here has not been tested in years. Van Jacobson claims to have
384 better kernel debugging, but won't release it for ordinary mortals.
389 The files m68k-stub.c and i386-stub.c contain two examples of remote
390 stubs to be used with remote.c. They are designeded to run standalone
391 on a 68k or 386 cpu and communicate properly with the remote.c stub
394 The file rem-multi.shar contains a general stub that can probably
395 run on various different flavors of unix to allow debugging over a
396 serial line from one machine to another.
398 The files remote-eb.c and remote-nindy.c are two examples of remote
399 interfaces for talking to existing ROM monitors (for the AMD 29000 and the
400 Intel 960 repsectively).
402 Remote-vx.c and the vx-share subdirectory contain a remote interface for the
403 VxWorks realtime kernel, which communicates over TCP using the Sun
404 RPC library. This would be a useful starting point for other remote-
405 via-ethernet back ends.
407 [This section seems to be out of date, I have never seen the "rapp"
408 program, though I would like to. FIXME.]
409 `rapp' runs under unix and acts as a remote stub (like rem-multi.shar
410 distributed with GDB version 3). Currently it just works over UDP
411 (network), not over a serial line. To get it running
412 * Compile GDB on the host machine as usual
413 * Compile rapp on the target machine, giving for both host and target
414 the type of the target machine
415 * Install "gdb" in /etc/services on both machines.
420 The correct address for reporting bugs found in gdb is
421 "bug-gdb@prep.ai.mit.edu". Please email all bugs to that address.
423 GDB can produce warnings about symbols that it does not understand. By
424 default, these warnings are disabled. You can enable them by executing
425 `set complaint 10' (which you can put in your ~/.gdbinit if you like).
426 I recommend doing this if you are working on a compiler, assembler,
427 linker, or gdb, since it will point out problems that you may be able
428 to fix. Warnings produced during symbol reading indicate some mismatch
429 between the object file and GDB's symbol reading code (in many cases,
430 it's a mismatch between the specs for the object file format, and what
431 the compiler actually outputs or the debugger actually understands).
433 If you port gdb to a new machine, please send the required changes
434 to bug-gdb@prep.ai.mit.edu. If your changes are more than a few
435 lines, obtain and send in a copyright assignment from gnu@prep.ai.mit.edu, as
436 described in the section `Writing Code for GDB'.
441 xgdb is obsolete. We are not doing any development or support of it.
443 There is an "xxgdb", which shows more promise, which was posted to
446 For those intersted in auto display of source and the availability of
447 an editor while debugging I suggest trying gdb-mode in gnu-emacs
448 (Try typing M-x gdb RETURN). Comments on this mode are welcome.
451 About the machine-dependent files
454 This contains Makefile stuff for when the target system is <machine>.
455 It also specifies the name of the tm-XXX.h file for this machine.
458 This contains Makefile stuff for when the host system is <machine>.
459 It also specifies the name of the xm-XXX.h file for this machine.
461 tm-XXX.h (tm.h is a link to this file, created by configure).
462 This file contains macro definitions about the target machine's
463 registers, stack frame format and instructions.
465 xm-XXX.h (xm.h is a link to this file, created by configure).
466 This contains macro definitions describing the host system environment,
467 such as byte order, host C compiler and library, ptrace support,
468 and core file structure.
472 These files contain the information necessary to print instructions
473 for your cpu type. <machine>-opcode.h includes some large initialized
474 data structures, which is strange for a ".h" file, but it's OK since
475 it is only included in one place. <machine>-opcode.h is shared
476 between the debugger and the assembler (if the GNU assembler has been
477 ported to that machine), whereas <machine>-pinsn.c is specific to GDB.
480 This file contains any miscellaneous code required for this machine
481 as a target. On some machines it doesn't exist at all. Its existence
482 is specified in the tconfig/XXX file.
485 This file contains any miscellaneous code required for this machine
486 as a host. On some machines it doesn't exist at all. Its existence
487 is specified in the xconfig/XXX file.
490 This is the low level interface to inferior processes for systems
491 using the Unix ptrace call in a vanilla way. Some systems have their
492 own routines in <machine>-xdep.c. Whether or not it is used
493 is specified in the xconfig/XXX file.
496 Machine and system-dependent aspects of reading core files. Some
497 machines use coredep.c; some have the routines in <machine>-xdep.c.
498 Whether or not it is used is specified in the xconfig/XXX file.
499 Now that BFD is used to read core files, virtually all machines should
500 use coredep.c and should just provide fetch_core_registers in
504 Machine and system-dependent aspects of reading executable files.
505 Some machines use exec.c; some have the routines in <machine>-tdep.c
506 Since BFD, virtually all machines should use exec.c.
511 We appreciate having users contribute code that is of general use, but
512 for it to be included in future GDB releases it must be cleanly
513 written. We do not want to include changes that will needlessly make
514 future maintainance difficult. It is not much harder to do things
515 right, and in the long term it is worth it to the GNU project, and
516 probably to you individually as well.
518 Please code according to the GNU coding standards. If you do not have
519 a copy, you can request one by sending mail to gnu@prep.ai.mit.edu.
521 If you make substantial changes, you'll have to file a copyright
522 assignment with the Free Software Foundation before we can produce a
523 release that includes your changes. Send mail requesting the copyright
524 assignment to gnu@prep.ai.mit.edu. Do this early, like before the
525 changes actually work, or even before you start them, because a manager
526 or lawyer on your end will probably make this a slow process.
528 Please try to avoid making machine-specific changes to
529 machine-independent files. If this is unavoidable, put a hook in the
530 machine-independent file which calls a (possibly) machine-dependent
531 macro (for example, the IGNORE_SYMBOL macro can be used for any
532 symbols which need to be ignored on a specific machine. Calling
533 IGNORE_SYMBOL in dbxread.c is a lot cleaner than a maze of #if
534 defined's). The machine-independent code should do whatever "most"
535 machines want if the macro is not defined in param.h. Using #if
536 defined can sometimes be OK (e.g. SET_STACK_LIMIT_HUGE) but should be
537 conditionalized on a specific feature of an operating system (set in
538 tm.h or xm.h) rather than something like #if defined(vax) or #if
539 defined(SYSV). If you use an #ifdef on some symbol that is defined
540 in a header file (e.g. #ifdef TIOCSETP), *please* make sure that you
541 have #include'd the relevant header file in that module!
543 It is better to replace entire routines which may be system-specific,
544 rather than put in a whole bunch of hooks which are probably not going
545 to be helpful for any purpose other than your changes. For example,
546 if you want to modify dbxread.c to deal with DBX debugging symbols
547 which are in COFF files rather than BSD a.out files, do something
548 along the lines of a macro GET_NEXT_SYMBOL, which could have
549 different definitions for COFF and a.out, rather than trying to put
550 the necessary changes throughout all the code in dbxread.c that
551 currently assumes BSD format.
553 Please avoid duplicating code. For example, in GDB 3.x all the stuff
554 in infptrace.c was duplicated in *-dep.c, and so changing something
555 was very painful. In GDB 4.x, these have all been consolidated
556 into infptrace.c. infptrace.c can deal with variations between
557 systems the same way any system-independent file would (hooks, #if
558 defined, etc.), and machines which are radically different don't need
559 to use infptrace.c at all. The same was true of core_file_command
560 and exec_file_command.
563 Debugging gdb with itself
565 If gdb is limping on your machine, this is the preferred way to get it
566 fully functional. Be warned that in some ancient Unix systems, like
567 Ultrix 4.0, a program can't be running in one process while it is being
568 debugged in another. Rather than doing "./gdb ./gdb", which works on
569 Suns and such, you can copy gdb to gdb2 and then do "./gdb ./gdb2".
571 When you run gdb in this directory, it will read a ".gdbinit" file that
572 sets up some simple things to make debugging gdb easier. The "info"
573 command, when executed without a subcommand in a gdb being debugged by
574 gdb, will pop you back up to the top level gdb. See .gdbinit for details.
576 I strongly recommend printing out the reference card and using it.
577 Send reference-card suggestions to bug-gdb@prep.ai.mit.edu, just like bugs.
579 If you use emacs, you will probably want to do a "make TAGS" after you
580 configure your distribution; this will put the machine dependent
581 routines for your local machine where they will be accessed first by a
584 Also, make sure that you've compiled gdb with your local cc or taken
585 appropriate precautions regarding ansification of include files. See
586 the Makefile for more information.
588 (this is for editing this file with GNU emacs)