2001-10-30 Michael Snyder <msnyder@redhat.com>
[deliverable/binutils-gdb.git] / gdb / README
CommitLineData
aba7b4b6
AC
1 README for gdb-5.0 release
2 Updated 11 May 2000 by Andrew Cagney
c906108c
SS
3
4This is GDB, the GNU source-level debugger.
5A summary of new features is in the file `NEWS'.
6
7a292a7a
SS
7See the GDB home page at http://sourceware.cygnus.com/gdb/ for up to
8date release information, mailing list links and archives, etc.
c906108c
SS
9
10
11Unpacking and Installation -- quick overview
12==========================
13
aba7b4b6 14 In this release, the GDB debugger sources, the generic GNU include
c906108c
SS
15files, the BFD ("binary file description") library, the readline
16library, and other libraries all have directories of their own
aba7b4b6 17underneath the gdb-5.0 directory. The idea is that a variety of GNU
c906108c
SS
18tools can share a common copy of these things. Be aware of variation
19over time--for example don't try to build gdb with a copy of bfd from
20a release other than the gdb release (such as a binutils or gas
21release), especially if the releases are more than a few weeks apart.
22Configuration scripts and makefiles exist to cruise up and down this
23directory tree and automatically build all the pieces in the right
24order.
25
aba7b4b6
AC
26 When you unpack the gdb-5.0.tar.gz file, you'll find a directory
27called `gdb-5.0', which contains:
c906108c 28
aba7b4b6
AC
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
c906108c 37
bec71058 38You can build GDB right in the source directory:
c906108c 39
aba7b4b6 40 cd gdb-5.0
c906108c
SS
41 ./configure
42 make
43 cp gdb/gdb /usr/local/bin/gdb (or wherever you want)
44
bec71058
FN
45However, we recommend that an empty directory be used instead.
46This way you do not clutter your source tree with binary files
47and will be able to create different builds with different
48configuration options.
49
50You can build GDB in any empty build directory:
51
52
53 mkdir build
54 cd build
55 <full path to your sources>/gdb-5.0/configure
56 make
57
c63ce875 58(Building GDB with DJGPP tools for MS-DOS/MS-Windows is slightly
aba7b4b6 59different; see the file gdb-5.0/gdb/config/djgpp/README for details.)
c63ce875 60
aba7b4b6
AC
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
63argument, e.g., `./configure sun4' or `./configure decstation'.
c906108c 64
aba7b4b6
AC
65 If you get compiler errors during this stage, see the `Reporting
66Bugs' section below; there are a few known problems.
c906108c 67
aba7b4b6
AC
68 GDB requires an ISO-C (ANSI C) compiler. If you do not have an
69ISO-C compiler for your system, you may be able to download and
70install the GNU CC compiler. It is available via anonymous FTP from
71the directory `ftp://ftp.gnu.org/pub/gnu/gcc'.
c906108c 72
aba7b4b6
AC
73 GDB can be used as a cross-debugger, running on a machine of one
74type while debugging a program running on a machine of another type.
75See below.
c906108c
SS
76
77
78More Documentation
79******************
80
81 All the documentation for GDB comes as part of the machine-readable
aba7b4b6
AC
82distribution. The documentation is written in Texinfo format, which
83is a documentation system that uses a single source file to produce
84both on-line information and a printed manual. You can use one of the
85Info formatting commands to create the on-line version of the
86documentation and TeX (or `texi2roff') to typeset the printed version.
87
88 GDB includes an already formatted copy of the on-line Info version
89of 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
91matching `gdb.info*' in the same directory. If necessary, you can
92print out these files, or read them with any editor; but they are
93easier to read using the `info' subsystem in GNU Emacs or the
94standalone `info' program, available as part of the GNU Texinfo
95distribution.
c906108c
SS
96
97 If you want to format these Info files yourself, you need one of the
98Info formatting programs, such as `texinfo-format-buffer' or
99`makeinfo'.
100
101 If you have `makeinfo' installed, and are in the top level GDB
aba7b4b6 102source directory (`gdb-5.0', in the case of version 5.0), you can make
c906108c
SS
103the Info file by typing:
104
105 cd gdb/doc
106 make info
107
108 If you want to typeset and print copies of this manual, you need
109TeX, a program to print its DVI output files, and `texinfo.tex', the
110Texinfo definitions file. This file is included in the GDB
aba7b4b6 111distribution, in the directory `gdb-5.0/texinfo'.
c906108c
SS
112
113 TeX is a typesetting program; it does not print files directly, but
114produces output files called DVI files. To print a typeset document,
115you need a program to print DVI files. If your system has TeX
116installed, chances are it has such a program. The precise command to
117use depends on your system; `lpr -d' is common; another (for PostScript
118devices) is `dvips'. The DVI print command may require a file name
119without any extension or a `.dvi' extension.
120
121 TeX also requires a macro definitions file called `texinfo.tex'.
122This file tells TeX how to typeset a document written in Texinfo
123format. On its own, TeX cannot read, much less typeset a Texinfo file.
124 `texinfo.tex' is distributed with GDB and is located in the
aba7b4b6 125`gdb-5.0/texinfo' directory.
c906108c
SS
126
127 If you have TeX and a DVI printer program installed, you can typeset
128and print this manual. First switch to the the `gdb' subdirectory of
aba7b4b6 129the main source directory (for example, to `gdb-5.0/gdb') and then type:
c906108c 130
966beb0f
EZ
131 make doc/gdb.dvi
132
133 If you prefer to have the manual in PDF format, type this from the
134`gdb/doc' subdirectory of the main source directory:
135
136 make gdb.pdf
137
138For this to work, you will need the PDFTeX package to be installed.
c906108c
SS
139
140
141Installing GDB
142**************
143
144 GDB comes with a `configure' script that automates the process of
145preparing GDB for installation; you can then use `make' to build the
146`gdb' program.
147
148 The GDB distribution includes all the source code you need for GDB in
149a single directory, whose name is usually composed by appending the
150version number to `gdb'.
151
aba7b4b6 152 For example, the GDB version 5.0 distribution is in the `gdb-5.0'
c906108c
SS
153directory. That directory contains:
154
aba7b4b6 155`gdb-5.0/{COPYING,COPYING.LIB}'
c906108c
SS
156 Standard GNU license files. Please read them.
157
aba7b4b6 158`gdb-5.0/bfd'
c906108c
SS
159 source for the Binary File Descriptor library
160
aba7b4b6 161`gdb-5.0/config*'
c906108c
SS
162 script for configuring GDB, along with other support files
163
aba7b4b6 164`gdb-5.0/gdb'
c906108c
SS
165 the source specific to GDB itself
166
aba7b4b6 167`gdb-5.0/include'
c906108c
SS
168 GNU include files
169
aba7b4b6 170`gdb-5.0/libiberty'
c906108c
SS
171 source for the `-liberty' free software library
172
aba7b4b6 173`gdb-5.0/mmalloc'
c906108c
SS
174 source for the GNU memory-mapped malloc package
175
aba7b4b6 176`gdb-5.0/opcodes'
c906108c
SS
177 source for the library of opcode tables and disassemblers
178
aba7b4b6 179`gdb-5.0/readline'
c906108c 180 source for the GNU command-line interface
7a292a7a
SS
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.
c906108c 183
aba7b4b6 184`gdb-5.0/sim'
c906108c
SS
185 source for some simulators (ARM, D10V, SPARC, M32R, MIPS, PPC, V850, etc)
186
aba7b4b6 187`gdb-5.0/intl'
c906108c
SS
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.
191
aba7b4b6 192`gdb-5.0/texinfo'
c906108c
SS
193 The `texinfo.tex' file, which you need in order to make a printed
194 manual using TeX.
195
aba7b4b6 196`gdb-5.0/etc'
c906108c
SS
197 Coding standards, useful files for editing GDB, and other
198 miscellanea.
199
aba7b4b6 200`gdb-5.0/utils'
c906108c
SS
201 A grab bag of random utilities.
202
c63ce875
EZ
203 Note: the following instructions are for building GDB on Unix or
204Unix-like systems. Instructions for building with DJGPP for
205MS-DOS/MS-Windows are in the file gdb/config/djgpp/README.
c906108c
SS
206
207 The simplest way to configure and build GDB is to run `configure'
208from the `gdb-VERSION-NUMBER' source directory, which in this example
aba7b4b6 209is the `gdb-5.0' directory.
c906108c
SS
210
211 First switch to the `gdb-VERSION-NUMBER' source directory if you are
212not already in it; then run `configure'.
213
214 For example:
215
aba7b4b6 216 cd gdb-5.0
c906108c
SS
217 ./configure
218 make
219
220 Running `configure' followed by `make' builds the `bfd',
221`readline', `mmalloc', and `libiberty' libraries, then `gdb' itself.
222The configured source files, and the binaries, are left in the
223corresponding source directories.
224
225 `configure' is a Bourne-shell (`/bin/sh') script; if your system
226does not recognize this automatically when you run a different shell,
227you may need to run `sh' on it explicitly:
228
229 sh configure
230
231 If you run `configure' from a directory that contains source
aba7b4b6
AC
232directories for multiple libraries or programs, such as the `gdb-5.0'
233source directory for version 5.0, `configure' creates configuration
c906108c
SS
234files for every directory level underneath (unless you tell it not to,
235with the `--norecursion' option).
236
237 You can run the `configure' script from any of the subordinate
238directories in the GDB distribution, if you only want to configure that
239subdirectory; but be sure to specify a path to it.
240
aba7b4b6 241 For example, with version 5.0, type the following to configure only
c906108c
SS
242the `bfd' subdirectory:
243
aba7b4b6 244 cd gdb-5.0/bfd
c906108c
SS
245 ../configure
246
247 You can install `gdb' anywhere; it has no hardwired paths. However,
248you should make sure that the shell on your path (named by the `SHELL'
249environment variable) is publicly readable. Remember that GDB uses the
250shell to start your program--some systems refuse to let GDB debug child
251processes whose programs are not readable.
252
253
254Compiling GDB in another directory
255==================================
256
257 If you want to run GDB versions for several host or target machines,
258you need a different `gdb' compiled for each combination of host and
259target. `configure' is designed to make this easy by allowing you to
260generate each configuration in a separate subdirectory, rather than in
261the source directory. If your `make' program handles the `VPATH'
262feature correctly (GNU `make' and SunOS 'make' are two that should),
263running `make' in each of these directories builds the `gdb' program
264specified there.
265
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
268to specify a path to find `configure' itself from your working
269directory. If the path to `configure' would be the same as the
270argument to `--srcdir', you can leave out the `--srcdir' option; it
271will be assumed.)
272
aba7b4b6 273 For example, with version 5.0, you can build GDB in a separate
c906108c
SS
274directory for a Sun 4 like this:
275
aba7b4b6 276 cd gdb-5.0
c906108c
SS
277 mkdir ../gdb-sun4
278 cd ../gdb-sun4
aba7b4b6 279 ../gdb-5.0/configure
c906108c
SS
280 make
281
282 When `configure' builds a configuration using a remote source
283directory, 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
285the example, you'd find the Sun 4 library `libiberty.a' in the
286directory `gdb-sun4/libiberty', and GDB itself in `gdb-sun4/gdb'.
287
288 One popular reason to build several GDB configurations in separate
289directories is to configure GDB for cross-compiling (where GDB runs on
290one machine--the host--while debugging programs that run on another
291machine--the target). You specify a cross-debugging target by giving
292the `--target=TARGET' option to `configure'.
293
294 When you run `make' to build a program or library, you must run it
295in a configured directory--whatever directory you were in when you
296called `configure' (or one of its subdirectories).
297
298 The `Makefile' that `configure' generates in each source directory
299also runs recursively. If you type `make' in a source directory such
aba7b4b6
AC
300as `gdb-5.0' (or in a separate configured directory configured with
301`--srcdir=PATH/gdb-5.0'), you will build all the required libraries,
c906108c
SS
302and then build GDB.
303
304 When you have multiple hosts or targets configured in separate
305directories, you can run `make' on them in parallel (for example, if
306they are NFS-mounted on each of the hosts); they will not interfere
307with each other.
308
309
310Specifying names for hosts and targets
311======================================
312
313 The specifications used for hosts and targets in the `configure'
314script are based on a three-part naming scheme, but some short
315predefined aliases are also supported. The full naming scheme encodes
316three pieces of information in the following pattern:
317
318 ARCHITECTURE-VENDOR-OS
319
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
322`sparc-sun-sunos4'.
323
324 The `configure' script accompanying GDB does not provide any query
325facility to list all supported host and target names or aliases.
326`configure' calls the Bourne shell script `config.sub' to map
327abbreviations to full names; you can read the script, if you wish, or
328you can use it to test your guesses on abbreviations--for example:
329
330 % sh config.sub sun4
331 sparc-sun-sunos4.1.1
332 % sh config.sub sun3
333 m68k-sun-sunos4.1.1
334 % sh config.sub decstation
335 mips-dec-ultrix4.2
336 % sh config.sub hp300bsd
337 m68k-hp-bsd
338 % sh config.sub i386v
339 i386-pc-sysv
340 % sh config.sub i786v
341 Invalid configuration `i786v': machine `i786v' not recognized
342
343`config.sub' is also distributed in the GDB source directory
aba7b4b6 344(`gdb-5.0', for version 5.0).
c906108c
SS
345
346
347`configure' options
348===================
349
350 Here is a summary of the `configure' options and arguments that are
351most often useful for building GDB. `configure' also has several other
352options not listed here. *note : (configure.info)What Configure Does,
353for a full explanation of `configure'.
354
355 configure [--help]
356 [--prefix=DIR]
357 [--srcdir=PATH]
358 [--norecursion] [--rm]
359 [--enable-build-warnings]
360 [--target=TARGET]
361 [--host=HOST]
362 [HOST]
363
364You may introduce options with a single `-' rather than `--' if you
365prefer; but you may abbreviate option names if you use `--'.
366
367`--help'
368 Display a quick summary of how to invoke `configure'.
369
370`-prefix=DIR'
371 Configure the source to install programs and files under directory
372 `DIR'.
373
374`--srcdir=PATH'
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.
385
386`--norecursion'
387 Configure only the directory level where `configure' is executed;
388 do not propagate configuration to subdirectories.
389
390`--rm'
391 Remove the configuration that the other arguments specify.
392
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
397 following flags:
aba7b4b6
AC
398 -Wimplicit
399 -Wreturn-type
400 -Wcomment
401 -Wtrigraphs
402 -Wformat
403 -Wparentheses
c906108c 404 -Wpointer-arith
c906108c
SS
405
406`--target=TARGET'
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.
410
411 There is no convenient way to generate a list of all available
412 targets.
413
414`--host=HOST'
415 Configure GDB to run on the specified HOST.
416
417 There is no convenient way to generate a list of all available
418 hosts.
419
420`HOST ...'
421 Same as `--host=HOST'. If you omit this, GDB will guess; it's
422 quite accurate.
423
424`configure' accepts other options, for compatibility with configuring
425other GNU tools recursively; but these are the only options that affect
426GDB or its supporting libraries.
427
428
de6ed73f
AC
429Host/target specific installation notes
430=======================================
c906108c 431
4bb5d567 432hppa2.0-hp-hpux10.20
c906108c 433
4bb5d567
AC
434Due to a problem with libiberty/regex.c, GDB does not build on HP/UX
43510.20 when using the HP supplied compiler.
436
437Due to bit rot problems, GDB does not work on HP/UX 10.20 when built
438with GCC.
439
440
441hppa2.0w-hp-hpux11.00
442
443Due to a problem with ltconfig and long argument lines, GDB does not
444configure on HP/UX 11.00.
c906108c
SS
445
446
447Remote debugging
448=================
449
aba7b4b6
AC
450 The files m68k-stub.c, i386-stub.c, and sparc-stub.c are examples
451of remote stubs to be used with remote.c. They are designed to run
452standalone on an m68k, i386, or SPARC cpu and communicate properly
453with the remote.c stub over a serial line.
c906108c 454
aba7b4b6 455 The directory gdb/gdbserver/ contains `gdbserver', a program that
c906108c 456allows remote debugging for Unix applications. gdbserver is only
aba7b4b6
AC
457supported for some native configurations, including Sun 3, Sun 4, and
458Linux.
c906108c 459
aba7b4b6 460 There are a number of remote interfaces for talking to existing ROM
c906108c
SS
461monitors and other hardware:
462
463 remote-adapt.c AMD 29000 "Adapt"
464 remote-array.c Array Tech RAID controller
465 remote-bug.c Motorola BUG monitor
c906108c
SS
466 remote-e7000.c Hitachi E7000 ICE
467 remote-eb.c AMD 29000 "EBMON"
468 remote-es.c Ericsson 1800 monitor
469 remote-est.c EST emulator
470 remote-hms.c Hitachi Micro Systems H8/300 monitor
471 remote-mips.c MIPS remote debugging protocol
472 remote-mm.c AMD 29000 "minimon"
473 remote-nindy.c Intel 960 "Nindy"
474 remote-nrom.c NetROM ROM emulator
475 remote-os9k.c PC running OS/9000
476 remote-rdi.c ARM with Angel monitor
477 remote-rdp.c ARM with Demon monitor
478 remote-sds.c PowerPC SDS monitor
479 remote-sim.c Generalized simulator protocol
480 remote-st.c Tandem ST-2000 monitor
481 remote-udi.c AMD 29000 using the AMD "Universal Debug Interface"
482 remote-vx.c VxWorks realtime kernel
483
aba7b4b6
AC
484 Remote-vx.c and the vx-share subdirectory contain a remote
485interface for the VxWorks realtime kernel, which communicates over TCP
486using the Sun RPC library. This would be a useful starting point for
487other remote- via-ethernet back ends.
c906108c 488
aba7b4b6
AC
489 Remote-udi.c and the 29k-share subdirectory contain a remote
490interface for AMD 29000 programs, which uses the AMD "Universal Debug
491Interface". This allows GDB to talk to software simulators,
492emulators, and/or bare hardware boards, via network or serial
493interfaces. Note that GDB only provides an interface that speaks UDI,
494not a complete solution. You will need something on the other end
495that also speaks UDI.
c906108c
SS
496
497
498Reporting Bugs
499===============
500
aba7b4b6
AC
501 The correct address for reporting bugs found in gdb is
502"bug-gdb@gnu.org". Please email all bugs, and all requests for help
503with GDB, to that address. Please include the GDB version number
504(e.g., gdb-5.0), and how you configured it (e.g., "sun4" or "mach386
c906108c 505host, i586-intel-synopsys target"). Since GDB now supports so many
aba7b4b6
AC
506different configurations, it is important that you be precise about
507this. If at all possible, you should include the actual banner that
508GDB prints when it starts up, or failing that, the actual configure
509command that you used when configuring GDB.
c906108c 510
aba7b4b6
AC
511 For more information on how/whether to report bugs, see the GDB
512Bugs section of the GDB manual (gdb/doc/gdb.texinfo) or the
513gdb/CONTRIBUTE file.
c906108c 514
aba7b4b6
AC
515
516Graphical interface to GDB -- X Windows, MS Windows
517==========================
c906108c 518
aba7b4b6
AC
519 Several graphical interfaces to GDB are available. You should
520check:
c906108c 521
aba7b4b6 522 http://sourceware.cygnus.com/gdb/#gui
c906108c 523
aba7b4b6 524for an up-to-date list.
c906108c 525
aba7b4b6 526 Emacs users will very likely enjoy the Grand Unified Debugger mode;
f032fb6e 527try typing `M-x gdb RET'.
c906108c
SS
528
529
530Writing Code for GDB
531=====================
532
aba7b4b6 533 There is a lot of information about writing code for GDB in the
c906108c
SS
534internals manual, distributed with GDB in gdb/doc/gdbint.texinfo. You
535can read it by hand, print it by using TeX and texinfo, or process it
536into an `info' file for use with Emacs' info mode or the standalone
537`info' program.
538
aba7b4b6 539 If you are pondering writing anything but a short patch, especially
c906108c
SS
540take note of the information about copyrights in the node Submitting
541Patches. It can take quite a while to get all the paperwork done, so
542we encourage you to start that process as soon as you decide you are
543planning to work on something, or at least well ahead of when you
544think you will be ready to submit the patches.
545
546
547GDB Testsuite
548=============
549
aba7b4b6
AC
550 Included with the GDB distribution is a DejaGNU based testsuite
551that can either be used to test your newly built GDB, or for
552regression testing a GDB with local modifications.
553
554 Running the testsuite requires the prior installation of DejaGNU,
555which is generally available via ftp. The directory
556ftp://sourceware.cygnus.com/pub/dejagnu/ will contain a recent
557snapshot. Once DejaGNU is installed, you can run the tests in one of
558the following ways:
c906108c 559
aba7b4b6
AC
560 (1) cd gdb-5.0
561 make check-gdb
562
563or
c906108c 564
aba7b4b6 565 (2) cd gdb-5.0/gdb
c906108c
SS
566 make check
567
568or
569
aba7b4b6 570 (3) cd gdb-5.0/gdb/testsuite
c906108c
SS
571 make site.exp (builds the site specific file)
572 runtest -tool gdb GDB=../gdb (or GDB=<somepath> as appropriate)
573
aba7b4b6
AC
574The last method gives you slightly more control in case of problems
575with building one or more test executables or if you are using the
576testsuite `standalone', without it being part of the GDB source tree.
c906108c
SS
577
578See the DejaGNU documentation for further details.
579
580\f
581(this is for editing this file with GNU emacs)
582Local Variables:
583mode: text
584End:
This page took 0.134454 seconds and 4 git commands to generate.