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