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